home *** CD-ROM | disk | FTP | other *** search
- #include <exec/types.h>
- #include <exec/memory.h>
- #include <intuition/intuition.h>
- #include <intuition/gadgetclass.h>
- #include <libraries/iffparse.h>
- #include <dos/dos.h>
- #include <dos/datetime.h>
-
- #include <clib/alib_protos.h>
- #include <clib/exec_protos.h>
- #include <clib/intuition_protos.h>
- #include <clib/iffparse_protos.h>
- #include <clib/dos_protos.h>
-
- #define ALL_REACTION_CLASSES
- #define ALL_REACTION_MACROS
- #include <reaction/reaction.h>
-
- #include <ctype.h>
- #include <stdlib.h>
- #include <string.h>
- #include "rp.h"
-
- #define BYTESPERLINE 12 // how many bytes to print per line
- #define LABELLENGTH 25
-
- #define ITEMS 255
- MODULE struct
- { TEXT name[5];
- ULONG bytes;
- UBYTE* DataPtr;
- } contents[ITEMS + 1];
-
- #define FORMS 91
-
- #define CD 1
- #define OBSOLETE 2
- #define PRIVATE 4
- #define PROPOSAL 8
- #define RESERVED 16
- #define RKM 32
- #define STANDARD 64
- #define UNREGISTERED 128
-
- #define IFFXCHARS 13
-
- MODULE void iffquery(void);
- MODULE void PrintTopChunk(void);
- MODULE void readiff(void);
- MODULE void tellchunk(UWORD which);
- MODULE void chunkdesc(STRPTR desc, ABOOL isknown);
- MODULE void binarize(UBYTE data);
- MODULE void hexalize(UBYTE data);
- MODULE ULONG getulong(UBYTE* start);
- MODULE SLONG getslong(UBYTE* start);
- MODULE ULONG getuword(UBYTE* start);
- MODULE SLONG getsword(UBYTE* start);
- MODULE SLONG getsbyte(UBYTE* start);
- MODULE void writeiffgadgets(void);
- MODULE void dotextattr(UBYTE* offset);
- MODULE void docountry(UBYTE* offset);
- MODULE void label(STRPTR text);
- MODULE void dobool(UBYTE thebool);
- MODULE void snumcat(SLONG thenumber, ABOOL finished);
- MODULE void unumcat(ULONG thenumber, ABOOL finished);
- MODULE void interpret(ULONG tablenum, ULONG value);
-
- #define TABLENUMS 54
- #define TABLEENTRIES 13
-
- struct
- { UBYTE entries;
- STRPTR tablestring[TABLEENTRIES + 1];
- } table[TABLENUMS + 1] =
- { { 2, // 0
- "XON", // HSHAKE_XON
- "RTS", // HSHAKE_RTS
- "None" // HSHAKE_NONE
- },
- { 2, // 1
- "none",
- "superscript",
- "subscript"
- },
- { 2, // 2
- "Unknown",
- "No",
- "Yes"
- },
- { 4, // 3
- "None",
- "Even",
- "Odd",
- "Mark",
- "Space"
- },
- { 2, // 4
- "name",
- "date",
- "size"
- },
- { 2, // 5
- "first",
- "mix",
- "last"
- },
- { 1, // 6
- "ascending",
- "descending"
- },
- { 5, // 7
- "default",
- "centre in window",
- "centre on screen",
- "top left of window",
- "top left of screen",
- "mouse pointer"
- },
- { 2, // 8
- "Workbench",
- "system",
- "screen"
- },
- { 3, // 9
- "JAM1",
- "JAM2",
- "complement",
- "inverse video"
- },
- { 1, // 10
- "PostScript", // DM_POSTSCRIPT
- "pass through" // DM_PASSTHROUGH
- },
- { 3, // 11
- "US Letter", // PF_USLETTER
- "US Legal", // PF_USLEGAL
- "A4", // PF_A4
- "custom" // PF_CUSTOM
- },
- { 8, // 12
- "Courier",
- "Times",
- "Helvetica",
- "Helvetica Narrow",
- "Avant Garde",
- "Bookman",
- "New Century",
- "Palantino",
- "Zapf Chancery"
- },
- { 2, // 13
- "normal",
- "compressed",
- "expanded"
- },
- { 1, // 14
- "portrait",
- "landscape"
- },
- { 4, // 15
- "4 characters",
- "8 characters",
- "quarter-inch",
- "half-inch",
- "inch"
- },
- { 1, // 16
- "positive",
- "negative"
- },
- { 2, // 17
- "black and white", // SHAD_BW
- "greyscale", // SHAD_GREYSCALE
- "colour" // SHAD_COLOR
- },
- { 4, // 18
- "default", // DITH_DEFAULT
- "dotty", // DITH_DOTTY
- "vertical", // DITH_VERT
- "horizontal", // DITH_HORIZ
- "diagonal" // DITH_DIAG
- },
- { 1, // 19
- "horizontal", // ASP_HORIZ
- "vertical" // ASP_VERT
- },
- { 6, // 20
- "aspect as is", // ST_ASPECT_ASIS
- "aspect wide", // ST_ASPECT_WIDE
- "aspect tall", // ST_ASPECT_TALL
- "aspect both", // ST_ASPECT_BOTH
- "fits wide", // ST_FITS_WIDE
- "fits tall", // ST_FITS_TALL
- "fits both" // ST_FITS_BOTH
- },
- { 3, // 21
- "none", // CENT_NONE
- "horizontal", // CENT_HORIZ
- "vertical", // CENT_VERT
- "both" // CENT_BOTH
- },
- { 3, // 22
- "black and white", // PS_BW
- "greyscale 1", // PS_GREYSCALE
- "colour", // PS_COLOR
- "greyscale 2" // PS_GREY_SCALE2
- },
- { 4, // 23
- "ignore", // PD_IGNORE
- "bounded", // PD_BOUNDED
- "absolute", // PD_ABSOLUTE
- "printer pixels", // PD_PIXEL
- "multiply" // PD_MULTIPLY
- },
- { 2, // 24
- "ordered", // PD_ORDERED
- "halftone", // PD_HALFTONE
- "Floyd-Steinberg" // PD_FLOYD
- },
- { 1, // 25
- "parallel", // PP_PARALLEL
- "serial" // PP_SERIAL
- },
- { 1, // 26
- "fanfold", // PT_FANFOLD
- "single sheet" // PT_SINGLE
- },
- { 13, // 27
- "US Letter", // PS_US_LETTER
- "US Legal", // PS_US_LEGAL
- "narrow tractor", // PS_N_TRACTOR
- "wide tractor", // PS_W_TRACTOR
- "custom", // PS_CUSTOM
- "A0: 841x1189mm", // PS_EURO_A0
- "A1: 594x841mm", // PS_EURO_A1
- "A2: 420x594mm", // PS_EURO_A2
- "A3: 297x420mm", // PS_EURO_A3
- "A4: 210x297mm", // PS_EURO_A4
- "A5: 148x210mm", // PS_EURO_A5
- "A6: 105x148mm", // PS_EURO_A6
- "A7: 74x105mm", // PS_EURO_A7
- "A8: 52x74mm", // PS_EURO_A8
- },
- { 2, // 28
- "Pica", // PP_PICA
- "Elite", // PP_ELITE
- "Fine" // PP_FINE
- },
- { 1, // 29
- "6 lines per inch", // PS_SIX_LPI
- "8 lines per inch", // PS_EIGHT_LPI
- },
- { 1, // 30
- "draft", // PQ_DRAFT
- "letter" // PQ_LETTER
- },
- { 1, // 31
- "beep", // SPTYPE_BEEP
- "sample" // SPTYPE_SAMPLE
- },
- { 2, // 32
- "Workbench", // WBP_ROOT
- "window", // WBP_DRAWER
- "screen" // WBP_SCREEN
- },
- { 1, // 33
- "normal",
- "busy"
- },
- { 6, // 34
- "default", // POINTERXRESN_DEFAULT
- "140ns", // POINTERXRESN_140NS
- "70ns", // POINTERXRESN_70NS
- "35ns", // POINTERXRESN_35NS
- "screen", // POINTERXRESN_SCREENRES
- "low resolution", // POINTERXRESN_LORES
- "high resolution" // POINTERXRESN_HIRES
- },
- { 4, // 35
- "default", // POINTERYRESN_DEFAULT
- "high non-aspect", // POINTERYRESN_HIGH
- "high aspect", // POINTERYRESN_HIGHASPECT
- "screen non-aspect", // POINTERYRESN_SCREENRES
- "screen aspect" // POINTERYRESN_SCREENRESASPECT
- },
- { 3, // 36
- "none",
- "low",
- "high",
- "all"
- },
- { 4, // 37
- "GadTools 2:1",
- "ReAction 1:1",
- "ReAction 2:1",
- "XEN 2:1",
- "XEN 1:1"
- },
- { 2, // 38
- "GadTools", // GLT_GT
- "flat", // GLT_FLAT
- "3D" // GLT_3D
- },
- { 2, // 39
- "centre",
- "left",
- "right"
- },
- { 1, // 40
- "Find by name",
- "Find on MIDI"
- },
- { 4, // 41
- "1, 2, 3...",
- "I, II, III...",
- "i, ii, iii...",
- "A, B, C...",
- "a, b, c..."
- },
- { 3, // 42
- "none",
- "left",
- "right",
- "both"
- },
- { 3, // 43
- "left",
- "centre",
- "right",
- "full"
- },
- { 3, // 44
- "left",
- "centre",
- "right",
- "decimal"
- },
- { 3, // 45
- "opaque",
- "mask plane",
- "transparent colour",
- "lasso"
- },
- { 1, // 46
- "none",
- "byte run encoding"
- },
- { 2, // 47
- "no looping",
- "forwards looping",
- "forwards/backwards looping"
- },
- { 1, // 48
- "none",
- "Fibonacci-delta encoding"
- },
- { 6, // 49
- "set directly",
- "XOR ILBM",
- "long delta",
- "short delta",
- "short/long delta",
- "byte vertical delta",
- "stereo op 5"
- },
- { 3, // 50
- "metric", // MS_ISO
- "American", // MS_AMERICAN
- "Imperial", // MS_IMPERIAL
- "British" // MS_BRITISH
- },
- { 1, // 51
- "No", // SS_NOSPACE
- "Yes" // SS_SPACE
- },
- { 4, // 52
- "parentheses around amount and symbol", // SP_PARENS
- "sign is before amount and symbol", // SP_PREC_ALL
- "sign is after amount and symbol", // SP_SUCC_ALL
- "sign is before symbol", // SP_PREC_CURR
- "sign is after symbol" // SP_SUCC_CURR
- },
- { 1, // 53
- "symbol is before amount", // CSP_PRECEDES
- "symbol is after amount" // CSP_SUCCEEDS
- },
- { 6, // 54
- "Sunday",
- "Monday",
- "Tuesday",
- "Wednesday",
- "Thursday",
- "Friday",
- "Saturday"
- } };
-
- /* Text error messages for possible IFFERR_#? returns from various IFF
- * routines. To get the index into this array, take your IFFERR code,
- * negate it, and subtract one.
- * idx = -error - 1;
- */
- STRPTR errormsgs[] =
- { "End of file (not an error).",
- "End of context (not an error).",
- "No lexical scope.",
- "Insufficient memory.",
- "Stream read error.",
- "Stream write error.",
- "Stream seek error.",
- "File is corrupt.",
- "IFF syntax error.",
- "Not an IFF file.",
- "Required call-back hook missing.",
- "Return to client. You should never see this."
- };
-
- // from rp.c
- IMPORT SBYTE page;
- IMPORT struct Window* MainWindowPtr;
- IMPORT struct TextAttr Topaz8;
- IMPORT TEXT aslresult[VLONGFIELD + 1],
- weekdaystring[LEN_DATSTRING],
- datestring[LEN_DATSTRING],
- timestring[LEN_DATSTRING],
- IOBuffer[LONGESTFIELD + 1];
- IMPORT Object* WinObject[FUNCTIONS + 1]; // note that WindowObject is a reserved macro
- IMPORT struct Menu* MenuPtr;
- IMPORT struct Screen* ScreenPtr;
-
- MODULE ABOOL known, first;
- MODULE struct IFFHandle* IFFHandle = NULL;
- MODULE struct List List1,
- List2;
- MODULE TEXT queryform[5] = "",
- tempstring1[VLONGFIELD + 1],
- tempstring2[13], // only for use with numbers
- tempstring3[VLONGFIELD + 1];
- MODULE ULONG items = 0; // value of this is actual number of items allocated
- MODULE UWORD selectedform = 0,
- selectedchunk = 0;
- MODULE struct Gadget* iff_gadgets[GIDS_6 + 1];
-
- AGLOBAL struct IFFStruct iff;
-
- MODULE struct
- { UBYTE flags;
- TEXT name[5];
- STRPTR desc;
- STRPTR contributor;
- } form[FORMS + 1] =
- { STANDARD | RKM | CD, "8SVX", "EA IFF 85 8-bit sound sample form", "EA/CBM",
- RKM | CD, "AIFF", "Audio 1-32 bit samples", "Apple",
- RKM | CD, "ACBM", "Amiga Contiguous Bitmap", "CBM",
- UNREGISTERED, "AHAM", "?", "?",
- RKM | CD, "ANBM", "ANimated BitMap form", "EA",
- RKM | CD, "ANIM", "Cel ANIMation form", "Sparta/Aegis",
- PROPOSAL, "ARC ", "ARChive format", "?",
- UNREGISTERED, "ARES", "?", "?",
- RESERVED, "ATXT", "Temporarily reserved", "?",
- PRIVATE, "AVCF", "AmigaVision Flow", "CBM",
- NULL, "BANK", "Soundquest Editor/Librarian MIDI Sysex dump", "?",
- NULL, "BBSD", "BBS Database", "Phalanx Software",
- PRIVATE, "C100", "?", "Cloanto",
- STANDARD, "CAT ", "EA IFF 85 group identifier", "EA/CBM",
- PROPOSAL, "CELP", "Compressed ZyXEL voice data", "?",
- RESERVED, "CHBM", "Chunky bitmap", "Eric Lavitsky",
- NULL, "CLIP", "CAT CLIP to hold various formats in clipboard", "CBM",
- PROPOSAL | CD, "CMUS", "Common MUsical Score", "Talin (David Joiner)",
- NULL, "CPFM", "Cloanto Personal FontMaker", "Cloanto",
- UNREGISTERED, "CTLG", "Language CaTaLoG", "CBM",
- NULL, "DCCL", "DCTV paint clip", "?",
- NULL, "DCPA", "DCTV paint palette", "?",
- NULL, "DCTV", "DCTV raw picture file", "?",
- PRIVATE, "DECK", "Inovatronics CanDo", "Innovatronics",
- CD, "DEEP", "Chunky pixel image files (used in TV Paint)", "Amiga Centre Scotland",
- RKM | CD, "DR2D", "2D object standard format", "Ross Cunniff & John Orr",
- RESERVED, "DRAW", "?", "Jim Bayless",
- CD, "DTYP", "DataTYPes identification", "Amiga, Inc.",
- PROPOSAL | CD, "EXEC", "Executable (loadseg-able) code", "Chris Ludwig",
- RKM | CD, "FANT", "Fantavision movie format", "Broderbund",
- OBSOLETE | PRIVATE, "FAX3", "Facsimile image", "GPSoftware",
- CD, "FAXX", "Facsimile image", "Atlantis Design Group",
- RESERVED, "FIGR", "Deluxe Video", "EA",
- NULL, "FILM", "LIST FILM - stores ILBMs with interleaved 8SVX audio", "?",
- RESERVED, "FNTR", "Raster font", "EA",
- RESERVED, "FNTV", "Vector font", "EA",
- STANDARD, "FORM", "Group identifier", "EA/CBM",
- STANDARD | RKM, "FTXT", "Formatted TeXT", "EA/CBM",
- PROPOSAL | PRIVATE, "GRYP", "Byteplane storage", "?",
- RESERVED, "GSCR", "General music SCoRe", "EA",
- PROPOSAL | PRIVATE, "GUI ", "User interface storage", "?",
- RKM | CD, "HEAD", "Flow idea processor", "New Horizons Software",
- STANDARD | RKM | CD, "ILBM", "EA IFF 85 raster bitmap form", "EA/CBM",
- RESERVED, "IOBJ", "?", "Seven Seas Software",
- RESERVED, "IODK", "?", "Merging Technologies",
- RESERVED, "ITRF", "?", "?",
- RESERVED, "JMOV", "?", "Merging Technologies",
- STANDARD, "LIST", "EA IFF 85 group identifier", "EA/CBM",
- RESERVED, "MFAX", "Facsimile?", "TKR GmbH & Co.",
- NULL, "MIDI", "MIDI?", "Circum Design",
- PRIVATE, "MOVI", "LIST MOVIe?", "?",
- PRIVATE, "MSCX", "Music-X format", "?",
- RESERVED, "MSMP", "Temporarily reserved", "?",
- RKM | CD, "MTRX", "Numerical data storage (MathVision)", "Seven Seas Software",
- NULL, "NSEQ", "Numerical sequence", "Stockhausen GmbH",
- PROPOSAL | CD, "OB3D", "Standard 3D object", "?",
- RKM | CD, "PGTB", "ProGram TraceBack", "SAS Institute",
- RESERVED, "PICS", "Macintosh picture", "EA",
- RESERVED | OBSOLETE, "PLBM", "?", "EA",
- RESERVED | PROPOSAL | CD, "PMBC", "24-bit accurate images", "Black Belt Systems",
- RESERVED | PRIVATE, "PREF", "User preferences data", "CBM",
- STANDARD, "PROP", "Group identifier", "EA/CBM",
- RKM | CD, "PRSP", "DPaint IV perspective move form", "EA",
- NULL, "PTCH", "Patch file", "SAS Institute",
- RESERVED, "PTXT", "Temporarily reserved", "?",
- PRIVATE, "RGB4", "4-bit RGB", "?",
- RKM | CD, "RGB8", "RGB image (Turbo Silver)", "Impulse",
- RKM | CD, "RGBN", "RGB image (Turbo Silver)", "Impulse",
- RESERVED, "RGBX", "Temporarily reserved", "?",
- PRIVATE, "ROXN", "Animation", "?",
- UNREGISTERED, "RSND", "Sampled SouND", "Achim Stegemann",
- RKM | CD, "SAMP", "SAMPled sound", "Jim Fiore & Jeff Glatt",
- PRIVATE, "SC3D", "SCene format (Sculpt-3D)", "?",
- PRIVATE, "SHAK", "SHAKespeare format", "?",
- RESERVED | PRIVATE, "SHO1", "?", "Gary Bonham",
- RESERVED | PRIVATE, "SHOW", "?", "Gary Bonham",
- STANDARD | RKM, "SMUS", "Simple MUsic Score", "EA/CBM",
- CD, "SPLT", "File SPLiTting system", "ASDG",
- RESERVED, "SSRE", "?", "Merging Technologies",
- UNREGISTERED, "SWRT", "?", "?",
- NULL, "SYTH", "SoundQuest Master Librarian MIDI System driver", "?",
- RESERVED, "TCDE", "?", "Merging Technologies",
- RKM | CD, "TDDD", "3D rendering data (Turbo Silver)", "Impulse",
- UNREGISTERED, "TERM", "?", "?",
- CD, "TMUI", "ToolMaker User Interface", "Michael Erwin",
- CD, "TREE", "Arbitrary data structures as trees (or nested lists)", "Stefan Reisner",
- CD | PROPOSAL, "TRKR", "TRacKeR style music module", "Full Tilt Entertainment",
- RESERVED, "USCR", "Uhuru SCoRe", "EA",
- RESERVED, "UVOX", "Uhuru Macintosh VOiXe", "EA",
- PRIVATE, "VDEO", "Deluxe ViDEO", "EA",
- RKM | CD, "WORD", "ProWrite document", "New Horizons Software",
- CD, "YUVN", "For storage of Y:U:V image data", "MacroSystem"
- };
-
- AGLOBAL void iff1(void)
- { struct Hook Hook6Struct;
- STRPTR stringptr;
-
- InitHook(&Hook6Struct, Hook6Func, NULL);
-
- /* Create the window object. */
- lockscreen();
-
- if (!(WinObject[6] =
- NewObject
- ( WINDOW_GetClass(), NULL,
- WA_PubScreen, ScreenPtr,
- WA_ScreenTitle, "Report+",
- WA_Title, "Report+: IFF FORM Viewer",
- WA_Activate, TRUE,
- WA_DepthGadget, TRUE,
- WA_DragBar, TRUE,
- WA_CloseGadget, TRUE,
- WA_SizeGadget, TRUE,
- WA_IDCMP, IDCMP_RAWKEY,
- WINDOW_IDCMPHook, &Hook6Struct,
- WINDOW_IDCMPHookBits, IDCMP_RAWKEY,
- WINDOW_MenuStrip, MenuPtr,
- WINDOW_Position, WPOS_CENTERSCREEN,
- WINDOW_ParentGroup, iff_gadgets[GID_6_LY1] =
- NewObject
- ( LAYOUT_GetClass(), NULL,
- LAYOUT_Orientation, LAYOUT_ORIENT_VERT,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_DeferLayout, TRUE,
- LAYOUT_AddChild,
- NewObject
- ( LAYOUT_GetClass(), NULL,
- LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
- LAYOUT_DeferLayout, TRUE,
- LAYOUT_BevelStyle, BVS_NONE,
- LAYOUT_AddChild,
- NewObject
- ( LAYOUT_GetClass(), NULL,
- LAYOUT_Orientation, LAYOUT_ORIENT_VERT,
- LAYOUT_VertAlignment, LALIGN_CENTER,
- LAYOUT_BevelStyle, BVS_NONE,
- LAYOUT_AddChild,
- NewObject
- ( LAYOUT_GetClass(), NULL,
- LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
- LAYOUT_HorizAlignment,LALIGN_RIGHT,
- LAYOUT_BevelStyle, BVS_NONE,
- LAYOUT_AddImage,
- NewObject
- ( LABEL_GetClass(), NULL,
- LABEL_Text, "_FORM ID:",
- LABEL_Justification, LJ_RIGHT,
- TAG_END),
- TAG_END),
- LAYOUT_AddChild,
- NewObject
- ( LAYOUT_GetClass(), NULL,
- LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
- LAYOUT_HorizAlignment, LALIGN_RIGHT,
- LAYOUT_BevelStyle, BVS_NONE,
- LAYOUT_AddImage,
- NewObject
- ( LABEL_GetClass(), NULL,
- LABEL_Text, "Description:",
- LABEL_Justification, LJ_RIGHT,
- TAG_END),
- TAG_END),
- LAYOUT_AddChild,
- NewObject
- ( LAYOUT_GetClass(), NULL,
- LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
- LAYOUT_HorizAlignment, LALIGN_RIGHT,
- LAYOUT_BevelStyle, BVS_NONE,
- LAYOUT_AddImage,
- NewObject
- ( LABEL_GetClass(), NULL,
- LABEL_Text, "Contributor:",
- LABEL_Justification, LJ_RIGHT,
- TAG_END),
- TAG_END),
- LAYOUT_AddChild,
- NewObject
- ( LAYOUT_GetClass(), NULL,
- LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
- LAYOUT_HorizAlignment, LALIGN_RIGHT,
- LAYOUT_BevelStyle, BVS_NONE,
- LAYOUT_AddImage,
- NewObject
- ( LABEL_GetClass(), NULL,
- LABEL_Text, "Chunk info:",
- LABEL_Justification, LJ_RIGHT,
- TAG_END),
- TAG_END),
- LAYOUT_AddChild,
- NewObject
- ( LAYOUT_GetClass(), NULL,
- LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
- LAYOUT_HorizAlignment, LALIGN_RIGHT,
- LAYOUT_BevelStyle, BVS_NONE,
- LAYOUT_AddImage,
- NewObject
- ( LABEL_GetClass(), NULL,
- LABEL_Text, "_Pathname:",
- LABEL_Justification, LJ_RIGHT,
- TAG_END),
- TAG_END),
- LAYOUT_AddChild,
- NewObject
- ( LAYOUT_GetClass(), NULL,
- LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
- LAYOUT_HorizAlignment, LALIGN_RIGHT,
- LAYOUT_BevelStyle, BVS_NONE,
- LAYOUT_AddImage,
- NewObject
- ( LABEL_GetClass(), NULL,
- LABEL_Text, "Status:",
- LABEL_Justification, LJ_RIGHT,
- TAG_END),
- TAG_END),
- TAG_END),
- CHILD_WeightedWidth, 0,
- LAYOUT_AddChild,
- NewObject
- ( LAYOUT_GetClass(), NULL,
- LAYOUT_Orientation, LAYOUT_ORIENT_VERT,
- LAYOUT_VertAlignment, LALIGN_CENTER,
- LAYOUT_HorizAlignment, LALIGN_CENTER,
- LAYOUT_BevelStyle, BVS_NONE,
- LAYOUT_AddChild,
- NewObject
- ( LAYOUT_GetClass(), NULL,
- LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
- LAYOUT_VertAlignment, LALIGN_CENTER,
- LAYOUT_HorizAlignment,LALIGN_LEFT,
- LAYOUT_BevelStyle, BVS_NONE,
- LAYOUT_AddChild, iff_gadgets[GID_6_ST1] =
- NewObject
- ( STRING_GetClass(), NULL,
- GA_ID, GID_6_ST1,
- GA_TabCycle, TRUE,
- GA_RelVerify, TRUE,
- STRINGA_TextVal, queryform,
- STRINGA_ReplaceMode, TRUE,
- STRINGA_MinVisible, 4,
- STRINGA_MaxChars, 4 + 1,
- TAG_END),
- CHILD_WeightedWidth, 50,
- LAYOUT_AddChild, iff_gadgets[GID_6_CB1] =
- NewObject
- ( CHECKBOX_GetClass(), NULL,
- GA_ID, GID_6_CB1,
- GA_RelVerify, TRUE,
- GA_Text, "_Raw view only?",
- GA_Selected, (BOOL) iff.raw,
- TAG_END),
- CHILD_WeightedWidth, 50,
- TAG_END),
- LAYOUT_AddChild, iff_gadgets[GID_6_ST2] =
- NewObject
- ( STRING_GetClass(), NULL,
- GA_ID, GID_6_ST2,
- GA_ReadOnly, TRUE,
- STRINGA_TextVal, "-",
- STRINGA_MinVisible, 20,
- TAG_END),
- LAYOUT_AddChild, iff_gadgets[GID_6_ST3] =
- NewObject
- ( STRING_GetClass(), NULL,
- GA_ID, GID_6_ST3,
- GA_ReadOnly, TRUE,
- STRINGA_TextVal, "-",
- STRINGA_MinVisible, 20,
- TAG_END),
- LAYOUT_AddChild, iff_gadgets[GID_6_ST4] =
- NewObject
- ( STRING_GetClass(), NULL,
- GA_ID, GID_6_ST4,
- GA_ReadOnly, TRUE,
- STRINGA_TextVal, "-",
- STRINGA_MinVisible, 20,
- TAG_END),
- LAYOUT_AddChild,
- NewObject
- ( LAYOUT_GetClass(), NULL,
- LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
- LAYOUT_VertAlignment, LALIGN_CENTER,
- LAYOUT_HorizAlignment,LALIGN_LEFT,
- LAYOUT_BevelStyle, BVS_NONE,
- LAYOUT_AddChild, iff_gadgets[GID_6_ST6] =
- NewObject
- ( STRING_GetClass(), NULL,
- GA_ID, GID_6_ST6,
- GA_RelVerify, TRUE,
- GA_TabCycle, TRUE,
- STRINGA_TextVal, iff.pathname,
- STRINGA_MinVisible, 20,
- STRINGA_MaxChars, PATHNAMEFIELD,
- TAG_END),
- LAYOUT_AddChild, iff_gadgets[GID_6_BU1] =
- NewObject
- ( NULL, "button.gadget",
- GA_ID, GID_6_BU1,
- GA_RelVerify, TRUE,
- BUTTON_AutoButton,BAG_POPFILE,
- TAG_END),
- CHILD_WeightedWidth, 0,
- TAG_END),
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild, iff_gadgets[GID_6_ST5] =
- NewObject
- ( STRING_GetClass(), NULL,
- GA_ID, GID_6_ST5,
- GA_ReadOnly, TRUE,
- STRINGA_TextVal, "Ready.",
- STRINGA_MinVisible, 20,
- TAG_END),
- TAG_END),
- CHILD_WeightedWidth, 100,
- LAYOUT_AddChild,
- NewObject
- ( LAYOUT_GetClass(), NULL,
- LAYOUT_Orientation, LAYOUT_ORIENT_VERT,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_VertAlignment, LALIGN_CENTER,
- LAYOUT_HorizAlignment, LALIGN_LEFT,
- LAYOUT_BevelStyle, BVS_FIELD,
- LAYOUT_AddImage,
- NewObject
- ( LABEL_GetClass(), NULL,
- LABEL_Text, "FORM Status:",
- LABEL_Justification, LJ_RIGHT,
- TAG_END),
- LAYOUT_AddChild, iff_gadgets[GID_6_CB2] =
- NewObject
- ( CHECKBOX_GetClass(), NULL,
- GA_ID, GID_6_CB2,
- GA_Disabled, TRUE,
- GA_Text, "Obsolete?",
- GA_Selected, (BOOL) iff.obsolete,
- TAG_END),
- LAYOUT_AddChild, iff_gadgets[GID_6_CB3] =
- NewObject
- ( CHECKBOX_GetClass(), NULL,
- GA_ID, GID_6_CB3,
- GA_Disabled, TRUE,
- GA_Text, "Private?",
- GA_Selected, (BOOL) iff.private,
- TAG_END),
- LAYOUT_AddChild, iff_gadgets[GID_6_CB4] =
- NewObject
- ( CHECKBOX_GetClass(), NULL,
- GA_ID, GID_6_CB4,
- GA_Disabled, TRUE,
- GA_Text, "Proposal?",
- GA_Selected, (BOOL) iff.proposal,
- TAG_END),
- LAYOUT_AddChild, iff_gadgets[GID_6_CB5] =
- NewObject
- ( CHECKBOX_GetClass(), NULL,
- GA_ID, GID_6_CB5,
- GA_Disabled, TRUE,
- GA_Text, "Reserved?",
- GA_Selected, (BOOL) iff.reserved,
- TAG_END),
- LAYOUT_AddChild, iff_gadgets[GID_6_CB6] =
- NewObject
- ( CHECKBOX_GetClass(), NULL,
- GA_ID, GID_6_CB6,
- GA_Disabled, TRUE,
- GA_Text, "Standard?",
- GA_Selected, (BOOL) iff.standard,
- TAG_END),
- LAYOUT_AddChild, iff_gadgets[GID_6_CB7] =
- NewObject
- ( CHECKBOX_GetClass(), NULL,
- GA_ID, GID_6_CB7,
- GA_Disabled, TRUE,
- GA_Text, "Unregistered?",
- GA_Selected, (BOOL) iff.unregistered,
- TAG_END),
- TAG_END),
- CHILD_WeightedWidth, 0,
- TAG_END),
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild,
- NewObject
- ( LAYOUT_GetClass(), NULL,
- LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
- LAYOUT_HorizAlignment, LALIGN_CENTER,
- LAYOUT_BevelStyle, BVS_NONE,
- LAYOUT_AddChild,
- NewObject
- ( LAYOUT_GetClass(), NULL,
- LAYOUT_Orientation, LAYOUT_ORIENT_VERT,
- LAYOUT_HorizAlignment, LALIGN_CENTER,
- LAYOUT_BevelStyle, BVS_NONE,
- LAYOUT_AddImage,
- NewObject
- ( LABEL_GetClass(), NULL,
- LABEL_Text, "Chunks:",
- LABEL_Justification, LJ_CENTER,
- TAG_END),
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild, iff_gadgets[GID_6_LB1] =
- NewObject
- ( LISTBROWSER_GetClass(),NULL,
- GA_ID, GID_6_LB1,
- GA_RelVerify, TRUE,
- GA_TextAttr, &Topaz8,
- LISTBROWSER_Labels, (ULONG) &List1,
- TAG_END),
- CHILD_MinWidth, 140,
- TAG_END),
- CHILD_WeightedWidth, 100,
- LAYOUT_AddChild,
- NewObject
- ( LAYOUT_GetClass(), NULL,
- LAYOUT_Orientation, LAYOUT_ORIENT_VERT,
- LAYOUT_HorizAlignment, LALIGN_CENTER,
- LAYOUT_BevelStyle, BVS_NONE,
- LAYOUT_AddImage,
- NewObject
- ( LABEL_GetClass(), NULL,
- LABEL_Text, "Chunk contents:",
- LABEL_Justification, LJ_CENTER,
- TAG_END),
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild, iff_gadgets[GID_6_LB2] =
- NewObject
- ( LISTBROWSER_GetClass(),NULL,
- GA_ID, GID_6_LB2,
- GA_RelVerify, TRUE,
- GA_TextAttr, &Topaz8,
- LISTBROWSER_Labels, (ULONG) &List2,
- TAG_END),
- CHILD_MinWidth, 456,
- CHILD_MaxWidth, 456,
- TAG_END),
- CHILD_WeightedWidth, 0,
- TAG_END),
- CHILD_WeightedHeight, 100,
- CHILD_MinHeight, 160,
- LAYOUT_AddChild,
- NewObject
- ( LAYOUT_GetClass(), NULL,
- LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
- LAYOUT_HorizAlignment, LALIGN_RIGHT,
- LAYOUT_VertAlignment, LALIGN_CENTER,
- LAYOUT_BevelStyle, BVS_NONE,
- LAYOUT_AddImage,
- NewObject
- ( LABEL_GetClass(), NULL,
- LABEL_Text, "Documents:",
- LABEL_Justification, LJ_RIGHT,
- TAG_END),
- CHILD_WeightedWidth, 0,
- LAYOUT_AddChild, iff_gadgets[GID_6_CB8] =
- NewObject
- ( CHECKBOX_GetClass(), NULL,
- GA_ID, GID_6_CB8,
- GA_Disabled, TRUE,
- GA_Text, "RKM?",
- GA_Selected, (BOOL) iff.rkm,
- TAG_END),
- CHILD_WeightedWidth, 0,
- LAYOUT_AddChild, iff_gadgets[GID_6_CB9] =
- NewObject
- ( CHECKBOX_GetClass(), NULL,
- GA_ID, GID_6_CB9,
- GA_Disabled, TRUE,
- GA_Text, "ADCD 2.1?",
- GA_Selected, (BOOL) iff.cd,
- TAG_END),
- CHILD_WeightedWidth, 0,
- LAYOUT_AddImage, NewObject
- ( LABEL_GetClass(), NULL,
- LABEL_Text, "",
- TAG_END),
- CHILD_WeightedWidth, 100,
- TAG_END),
- CHILD_WeightedHeight, 0,
- TAG_END),
- TAG_END)))
- { rq("Can't create ReAction gadgets!");
- }
- unlockscreen();
- openwindow();
-
- if (iff.pathname[0])
- { readiff();
- } elif (queryform[0])
- { iffquery();
- }
-
- ActivateLayoutGadget(iff_gadgets[GID_6_LY1], MainWindowPtr, NULL, (Object) iff_gadgets[GID_6_ST6]);
-
- loop();
-
- if (!(GetAttr
- ( STRINGA_TextVal, iff_gadgets[GID_6_ST1], (ULONG *) &stringptr
- )))
- { rq("Unsupported inquiry!"); // should never happen
- }
- strcpy(queryform, stringptr);
-
- if (!(GetAttr
- ( STRINGA_TextVal, iff_gadgets[GID_6_ST6], (ULONG *) &stringptr
- )))
- { rq("Unsupported inquiry!"); // should never happen
- }
- strcpy(iff.pathname, stringptr);
-
- closewindow();
- // now that the window is closed we can free lists
- iff_exit();
- }
-
- AGLOBAL void iff_loop(ULONG gid)
- { STRPTR stringptr;
- ULONG code;
-
- switch(gid)
- {
- case GID_6_CB1:
- if (!(GetAttr
- ( GA_Selected, iff_gadgets[GID_6_CB1], (ULONG *) &iff.raw
- )))
- { rq("Unsupported inquiry!"); // should never happen
- }
- if (selectedchunk && known)
- { tellchunk(selectedchunk);
- }
- break;
- case GID_6_ST1:
- if (!(GetAttr
- ( STRINGA_TextVal, iff_gadgets[GID_6_ST1], (ULONG *) &stringptr
- )))
- { rq("Unsupported inquiry!"); // should never happen
- }
- strcpy(queryform, stringptr);
-
- iff.pathname[0] = 0;
- SetGadgetAttrs
- ( iff_gadgets[GID_6_ST6],
- MainWindowPtr, NULL,
- STRINGA_TextVal, iff.pathname,
- TAG_END
- );
- SetGadgetAttrs
- ( iff_gadgets[GID_6_ST5],
- MainWindowPtr, NULL,
- STRINGA_TextVal, "Ready.",
- TAG_END
- );
- iffquery();
- break;
- case GID_6_ST6:
- if (!(GetAttr
- ( STRINGA_TextVal, iff_gadgets[GID_6_ST6], (ULONG *) &stringptr
- )))
- { rq("Unsupported inquiry!"); // should never happen
- }
- strcpy(iff.pathname, stringptr);
- readiff();
- break;
- case GID_6_BU1:
- if (asl("~(#?.info)"))
- { strcpy(iff.pathname, aslresult);
- SetGadgetAttrs
- ( iff_gadgets[GID_6_ST6],
- MainWindowPtr, NULL,
- STRINGA_TextVal, iff.pathname,
- TAG_END
- );
- readiff();
- }
- break;
- case GID_6_LB1:
- /* code is the position within the list, starting from 0. */
-
- if (!(GetAttr
- ( LISTBROWSER_Selected, iff_gadgets[GID_6_LB1], (ULONG *) &code
- )))
- { rq("Unsupported inquiry!"); // should never happen
- }
- selectedchunk = code + 1;
- tellchunk(selectedchunk);
- break;
- default:
- break;
- } }
-
- MODULE void iffquery(void)
- { ULONG i;
-
- /* Make any corrections to input now, to make it
- easier to search the database. */
- for (i = 0; i <= 3; i++)
- if (queryform[i] >= 97 && queryform[i] <= 122)
- queryform[i] -= 32;
- elif (queryform[i] == 0)
- queryform[i] = ' ';
- queryform[4] = 0;
-
- SetGadgetAttrs
- ( iff_gadgets[GID_6_ST1],
- MainWindowPtr, NULL,
- STRINGA_TextVal, queryform,
- TAG_END
- );
-
- selectedform = (UWORD) -1;
- for (i = 0; i <= FORMS; i++)
- if
- ( queryform[0] == form[i].name[0]
- && queryform[1] == form[i].name[1]
- && queryform[2] == form[i].name[2]
- && queryform[3] == form[i].name[3]
- )
- { selectedform = i;
- break;
- }
- selectedchunk = 0;
- if (selectedform == (UWORD) -1)
- { iff.cd =
- iff.rkm =
- iff.private =
- iff.proposal =
- iff.obsolete =
- iff.reserved =
- iff.standard =
- iff.unregistered = FALSE;
-
- SetGadgetAttrs
- ( iff_gadgets[GID_6_ST2],
- MainWindowPtr, NULL,
- STRINGA_TextVal, "-",
- TAG_END
- );
- SetGadgetAttrs
- ( iff_gadgets[GID_6_ST3],
- MainWindowPtr, NULL,
- STRINGA_TextVal, "-",
- TAG_END
- );
- } else
- { iff.cd = form[selectedform].flags & CD;
- iff.rkm = form[selectedform].flags & RKM;
- iff.private = form[selectedform].flags & PRIVATE;
- iff.proposal = form[selectedform].flags & PROPOSAL;
- iff.obsolete = form[selectedform].flags & OBSOLETE;
- iff.reserved = form[selectedform].flags & RESERVED;
- iff.standard = form[selectedform].flags & STANDARD;
- iff.unregistered = form[selectedform].flags & UNREGISTERED;
-
- SetGadgetAttrs
- ( iff_gadgets[GID_6_ST2],
- MainWindowPtr, NULL,
- STRINGA_TextVal, form[selectedform].desc,
- TAG_END
- );
- SetGadgetAttrs
- ( iff_gadgets[GID_6_ST3],
- MainWindowPtr, NULL,
- STRINGA_TextVal, form[selectedform].contributor,
- TAG_END
- );
- }
-
- writeiffgadgets();
-
- SetGadgetAttrs
- ( iff_gadgets[GID_6_LB1],
- MainWindowPtr, NULL,
- LISTBROWSER_Labels, NULL, // detach it
- TAG_END
- );
- clearreactionlist(&List1);
-
- SetGadgetAttrs
- ( iff_gadgets[GID_6_LB2],
- MainWindowPtr, NULL,
- LISTBROWSER_Labels, NULL, // detach it
- TAG_END
- );
- clearreactionlist(&List2);
-
- for (i = 0; i < items; i++)
- { if (contents[i].DataPtr)
- { FreeMem(contents[i].DataPtr, contents[i].bytes);
- contents[i].DataPtr = NULL;
- } }
- items = 0;
- }
-
- MODULE void readiff(void)
- { LONG error;
-
- iffquery();
-
- /* Allocate IFF_File structure. */
- if (!(IFFHandle = AllocIFF()))
- { DisplayBeep(NULL);
- SetGadgetAttrs
- ( iff_gadgets[GID_6_ST5],
- MainWindowPtr, NULL,
- STRINGA_TextVal, "AllocIFF() failed!",
- TAG_END
- );
-
- goto bye;
- }
-
- first = TRUE;
-
- /* Set up IFF_File for AmigaDOS I/O. */
- if (!(IFFHandle->iff_Stream = Open(iff.pathname, MODE_OLDFILE)))
- { DisplayBeep(NULL);
- SetGadgetAttrs
- ( iff_gadgets[GID_6_ST5],
- MainWindowPtr, NULL,
- STRINGA_TextVal, "Can't open file!",
- TAG_END
- );
- SetGadgetAttrs
- ( iff_gadgets[GID_6_ST2],
- MainWindowPtr, NULL,
- STRINGA_TextVal, "-",
- TAG_END
- );
- SetGadgetAttrs
- ( iff_gadgets[GID_6_ST3],
- MainWindowPtr, NULL,
- STRINGA_TextVal, "-",
- TAG_END
- );
-
- queryform[0] = 0;
- iff.obsolete =
- iff.private =
- iff.proposal =
- iff.reserved =
- iff.standard =
- iff.unregistered =
- iff.rkm =
- iff.cd = FALSE;
- writeiffgadgets();
- goto bye;
- }
- InitIFFasDOS(IFFHandle);
-
- /* Start the IFF transaction. */
- if (error = OpenIFF(IFFHandle, IFFF_READ))
- { DisplayBeep(NULL);
- SetGadgetAttrs
- ( iff_gadgets[GID_6_ST5],
- MainWindowPtr, NULL,
- STRINGA_TextVal, "OpenIFF() failed!",
- TAG_END
- );
- goto bye;
- }
-
- while (1)
- { /* IFFPARSE_RAWSTEP permits us to have precision monitoring of the
- * parsing process, which is necessary if we wish to print the
- * structure of an IFF file.
- * ParseIFF() with _RAWSTEP will return the following things for
- * the following reasons:
- *
- * Return code: Reason:
- * 0 Entered new context.
- * IFFERR_EOC About to leave a context.
- * IFFERR_EOF Encountered end-of-file.
- * <anything else> A parsing error.
- */
- error = ParseIFF(IFFHandle, IFFPARSE_RAWSTEP);
-
- /*
- * Since we're only interested in when we enter a context, we
- * "discard" end-of-context (_EOC) events.
- */
- if (error == IFFERR_EOC)
- continue;
- elif (error)
- { // Leave the loop if there is any other error.
- break;
- }
-
- /* If we get here, error was zero. Print out the current state of
- * affairs. */
- PrintTopChunk();
- }
-
- /* If error was IFFERR_EOF, then the parser encountered the end of
- * the file without problems. Otherwise, we print a diagnostic.
- */
- if (error == IFFERR_EOF)
- { SetGadgetAttrs
- ( iff_gadgets[GID_6_ST5],
- MainWindowPtr, NULL,
- STRINGA_TextVal, "Ready.",
- TAG_END
- );
- SetGadgetAttrs
- ( iff_gadgets[GID_6_LB1],
- MainWindowPtr, NULL,
- LISTBROWSER_Labels, &List1,
- TAG_END
- );
- } else
- { SetGadgetAttrs
- ( iff_gadgets[GID_6_ST5],
- MainWindowPtr, NULL,
- STRINGA_TextVal, errormsgs[-error - 1],
- TAG_END
- );
- SetGadgetAttrs
- ( iff_gadgets[GID_6_LB1],
- MainWindowPtr, NULL,
- LISTBROWSER_Labels, NULL, // detach it
- TAG_END
- );
- }
-
- bye:
- if (IFFHandle)
- { /* Terminate the IFF transaction with the stream. Free all
- * associated structures. */
- CloseIFF(IFFHandle);
- // Close the stream itself.
- if (IFFHandle->iff_Stream)
- { Close(IFFHandle->iff_Stream);
- }
- // Free the IFF_File structure itself.
- FreeIFF(IFFHandle);
- IFFHandle = NULL;
- } }
-
- AGLOBAL void iff_exit(void)
- { ULONG i;
-
- if (IFFHandle)
- { /* Terminate the IFF transaction with the stream. Free all
- * associated structures. */
- CloseIFF(IFFHandle);
- // Close the stream itself.
- if (IFFHandle->iff_Stream)
- { Close(IFFHandle->iff_Stream);
- }
- // Free the IFF_File structure itself.
- FreeIFF(IFFHandle);
- IFFHandle = NULL;
- }
-
- clearreactionlist(&List2);
- clearreactionlist(&List1);
-
- for (i = 0; i < items; i++)
- { if (contents[i].DataPtr)
- { FreeMem(contents[i].DataPtr, contents[i].bytes);
- contents[i].DataPtr = NULL;
- } }
- items = 0;
- }
-
- MODULE void PrintTopChunk(void)
- { struct ContextNode* top;
- short i;
- char idbuf[5];
- ULONG length;
-
- /* Get a pointer to the context node describing the current context. */
- if (!(top = CurrentChunk(IFFHandle)))
- return;
-
- /* Print spaces equivalent to the current nesting depth of chunks
- * processed so far.
- * This will cause nested chunks to be printed out indented. */
-
- tempstring1[0] = 0;
- if (IFFHandle->iff_Depth > 2)
- { for (i = IFFHandle->iff_Depth - 2; i--; )
- strcat(tempstring1, " ");
- }
- strcpy(contents[items].name, IDtoStr(top->cn_ID, idbuf));
- contents[items].DataPtr = NULL;
-
- /* Print out the current chunk's ID and size. */
- strcat(tempstring1, IDtoStr(top->cn_ID, idbuf));
- stcl_d(tempstring2, top->cn_Size);
-
- length = IFFXCHARS - strlen(tempstring1) - strlen(tempstring2);
- for (i = 1; i <= length; i++)
- { strcat(tempstring1, " ");
- }
- strcat(tempstring1, tempstring2);
-
- /* Print the current chunk's type, with a newline. */
- addreactionnode(&List1, tempstring1);
-
- if (!strcmp(IDtoStr(top->cn_ID, idbuf), "FORM"))
- { if (first)
- { first = FALSE;
- strcpy(queryform, IDtoStr(top->cn_Type, idbuf));
- iffquery();
- } }
- else
- { contents[items].bytes = top->cn_Size;
- if (!(contents[items].DataPtr = AllocMem(contents[items].bytes, MEMF_CLEAR)))
- { rq("Out of memory!");
- }
- if (ReadChunkBytes(IFFHandle, contents[items].DataPtr, contents[items].bytes) < 0)
- { rq("ReadChunkBytes() failed!");
- } }
-
- items++;
- if (items > ITEMS)
- { rq("Too many chunks!");
- } }
-
- MODULE void tellchunk(UWORD which)
- { SLONG svalue;
- ULONG i, j, uvalue, length, markers, currentpos;
- struct DateTime DateTime;
-
- if (which == (UWORD) ~0)
- { return;
- }
-
- SetGadgetAttrs
- ( iff_gadgets[GID_6_LB2],
- MainWindowPtr, NULL,
- LISTBROWSER_Labels, NULL, // detach it
- TAG_END
- );
- clearreactionlist(&List2);
- known = FALSE;
-
- if (!stricmp(contents[which].name, "FORM"))
- { chunkdesc("-", TRUE);
- } elif (!stricmp(contents[which].name, "(c) "))
- { chunkdesc("© Copyright", TRUE);
-
- if (!iff.raw)
- { label("© Copyright:");
- strcat(tempstring1, contents[which].DataPtr);
- addreactionnode(&List2, tempstring1);
- } }
- elif (!stricmp(contents[which].name, "AUTH"))
- { chunkdesc("Author", TRUE);
-
- if (!iff.raw)
- { label("Author:");
- strcat(tempstring1, contents[which].DataPtr);
- addreactionnode(&List2, tempstring1);
- } }
- elif (!stricmp(contents[which].name, "ANNO"))
- { chunkdesc("Annotation", TRUE);
-
- if (!iff.raw)
- { label("Annotation:");
- strcat(tempstring1, contents[which].DataPtr);
- addreactionnode(&List2, tempstring1);
- } }
- elif (!stricmp(contents[which].name, "NAME"))
- { chunkdesc("Name", TRUE);
-
- if (!iff.raw)
- { label("Name:");
- strcat(tempstring1, contents[which].DataPtr);
- addreactionnode(&List2, tempstring1);
- } }
- elif (!stricmp(contents[which].name, "FVER"))
- { chunkdesc("AmigaDOS version string", TRUE);
-
- if (!iff.raw)
- { label("Version:");
- // bytes 0-5 are "$VER: "
- strcat(tempstring1, &contents[which].DataPtr[6]);
- addreactionnode(&List2, tempstring1);
- } }
- elif
- ( (!stricmp(queryform, "FTXT") || !stricmp(queryform, "WORD"))
- && !stricmp(contents[which].name, "FSCC")
- )
- { chunkdesc("Font/style/colour change", TRUE);
-
- if (!iff.raw)
- { label("Location:");
- uvalue = getuword(contents[which].DataPtr); // UWORD
- unumcat(uvalue, TRUE);
-
- label("Font number:");
- uvalue = contents[which].DataPtr[2]; // UBYTE
- unumcat(uvalue, TRUE);
-
- label("Style:");
- addreactionnode(&List2, tempstring1);
-
- label(" Underlined?");
- dobool(contents[which].DataPtr[3] & 1);
-
- label(" Bold?");
- dobool(contents[which].DataPtr[3] & 2);
-
- label(" Italic?");
- dobool(contents[which].DataPtr[3] & 4);
-
- label(" Extended?");
- dobool(contents[which].DataPtr[3] & 8);
-
- label(" ColourFont?");
- dobool(contents[which].DataPtr[3] & 64);
-
- label(" Tagged?");
- dobool(contents[which].DataPtr[3] & 128);
-
- label("Miscellaneous style:");
- interpret(1, (ULONG) contents[which].DataPtr[4]);
-
- label("Colour:");
- uvalue = contents[which].DataPtr[5]; // UBYTE
- unumcat(uvalue, TRUE);
- } }
- elif (!strcmp(queryform, "FTXT"))
- { if (!strcmp(contents[which].name, "FONS"))
- { chunkdesc("Font specifier", TRUE);
-
- if (!iff.raw)
- {
- label("ID number:");
- snumcat((SLONG) contents[which].DataPtr[0], FALSE);
- if (contents[which].DataPtr[0] > 9)
- { strcat(tempstring1, " (invalid)");
- }
- addreactionnode(&List2, tempstring1);
-
- // Next is a pad byte ([1]).
-
- label("Proportional?");
- interpret(2, (ULONG) contents[which].DataPtr[2]);
-
- label("Serifs?");
- interpret(2, (ULONG) contents[which].DataPtr[3]);
-
- label("Font name:");
- strcat(tempstring1, &(contents[which].DataPtr[4]));
- addreactionnode(&List2, tempstring1);
- } }
- elif (!strcmp(contents[which].name, "CHRS"))
- { chunkdesc("Stream of text", FALSE);
- } }
- elif (!strcmp(queryform, "PREF"))
- { if (!strcmp(contents[which].name, "ICTL"))
- { chunkdesc("IControl preferences", TRUE);
-
- if (!iff.raw)
- {
- label("Verify timeout:");
- uvalue = getuword(&(contents[which].DataPtr[16]));
- unumcat(uvalue, TRUE);
-
- label("Meta drag mouse event:");
- svalue = getsword(&(contents[which].DataPtr[18]));
- snumcat(svalue, TRUE);
-
- addreactionnode(&List2, "Flags:");
- uvalue = getulong(&(contents[which].DataPtr[20]));
-
- label(" Coerce colours?");
- dobool((UBYTE) (uvalue & 1)); // ICF_COERCE_COLORS
-
- label(" Coerce interlace?");
- dobool((UBYTE) (uvalue & 2)); // ICF_COERCE_LACE
-
- label(" String gadget filter?");
- dobool((UBYTE) (uvalue & 4)); // ICF_STRGAD_FILTER
-
- label(" Menu snap?");
- dobool((UBYTE) (uvalue & 8)); // ICF_MENUSNAP
-
- label(" Mode promotion?");
- dobool((UBYTE) (uvalue & 16)); // ICF_MODEPROMOTE
-
- label(" Square ratio?"); // this one is new for OS3.9
- dobool((UBYTE) (uvalue & 32)); // ICF_SQUARE_RATIO
-
- addreactionnode(&List2, "Command keys:");
-
- label(" Workbench to front:");
- snumcat((SLONG) contents[which].DataPtr[24], TRUE);
-
- label(" Front screen to back:");
- snumcat((SLONG) contents[which].DataPtr[25], TRUE);
-
- label(" Requester TRUE:");
- snumcat((SLONG) contents[which].DataPtr[26], TRUE);
-
- label(" Requester FALSE:");
- snumcat((SLONG) contents[which].DataPtr[27], TRUE);
- } }
- elif (!strcmp(contents[which].name, "SERL"))
- { chunkdesc("Serial preferences", TRUE);
-
- if (!iff.raw)
- {
- label("Unit 0 mapping:");
- uvalue = getulong(&(contents[which].DataPtr[12]));
- unumcat(uvalue, TRUE);
-
- label("Baud rate:");
- uvalue = getulong(&(contents[which].DataPtr[16]));
- unumcat(uvalue, FALSE);
- strcat(tempstring1, " bps");
- addreactionnode(&List2, tempstring1);
-
- label("Input buffer size:");
- uvalue = getulong(&(contents[which].DataPtr[20]));
- unumcat(uvalue, FALSE);
- if (uvalue > 65536)
- { strcat(tempstring1, "!");
- }
- addreactionnode(&List2, tempstring1);
-
- label("Output buffer size:");
- uvalue = getulong(&(contents[which].DataPtr[24]));
- unumcat(uvalue, FALSE);
- if (uvalue > 65536)
- { strcat(tempstring1, "!");
- }
- addreactionnode(&List2, tempstring1);
-
- label("Input handshaking:");
- interpret(0, (ULONG) contents[which].DataPtr[28]);
-
- label("Output handshaking:");
- interpret(0, (ULONG) contents[which].DataPtr[29]);
-
- label("Parity:");
- interpret(3, (ULONG) contents[which].DataPtr[30]);
-
- label("I/O bits per character:");
- snumcat((SLONG) contents[which].DataPtr[31], TRUE);
-
- label("Stop bits:");
- snumcat((SLONG) contents[which].DataPtr[32], TRUE);
- } }
- elif (!strcmp(contents[which].name, "ASL "))
- { chunkdesc("ASL preferences", TRUE);
-
- // 16 reserved bytes at start
-
- if (!iff.raw)
- { label("Sort by:");
- interpret(4, (ULONG) contents[which].DataPtr[16]);
-
- label("Sort drawers:");
- interpret(5, (ULONG) contents[which].DataPtr[17]);
-
- label("Sort order:");
- interpret(6, (ULONG) contents[which].DataPtr[18]);
-
- label("Override?");
- dobool(contents[which].DataPtr[19] & 64);
-
- label("Relative?");
- dobool(contents[which].DataPtr[19] & 16);
-
- label("Position:");
- interpret(7, (ULONG) contents[which].DataPtr[19] & 16);
-
- label("Left edge:");
- svalue = getsword(&(contents[which].DataPtr[20]));
- snumcat(svalue, TRUE);
-
- label("Top edge:");
- svalue = getsword(&(contents[which].DataPtr[22]));
- snumcat(svalue, TRUE);
-
- label("Relative width:");
- snumcat((SLONG) contents[which].DataPtr[24], FALSE);
- if (contents[which].DataPtr[24] < 25 || contents[which].DataPtr[24] > 100)
- { strcat(tempstring1, "!");
- }
- strcat(tempstring1, "%");
- addreactionnode(&List2, tempstring1);
-
- label("Relative height:");
- snumcat((SLONG) contents[which].DataPtr[25], FALSE);
- if (contents[which].DataPtr[25] < 25 || contents[which].DataPtr[25] > 100)
- { strcat(tempstring1, "!");
- }
- strcat(tempstring1, "%");
- addreactionnode(&List2, tempstring1);
- } }
- elif (!strcmp(contents[which].name, "FONT"))
- { chunkdesc("Font preferences", TRUE);
-
- // 14 reserved bytes at start
-
- if (!iff.raw)
- {
- label("Type:");
- uvalue = getuword(&(contents[which].DataPtr[14]));
- interpret(8, uvalue);
-
- label("Front pen:");
- snumcat((SLONG) contents[which].DataPtr[16], TRUE);
-
- label("Back pen:");
- snumcat((SLONG) contents[which].DataPtr[17], TRUE);
-
- label("Draw mode:");
- interpret(9, (ULONG) contents[which].DataPtr[18]);
-
- /* Now we have an undocumented pad byte, necessary for
- structure alignment purposes. */
-
- addreactionnode(&List2, "Text attributes:");
-
- dotextattr(&contents[which].DataPtr[20]);
-
- label("Name:");
- strcat(tempstring1, &(contents[which].DataPtr[28]));
- addreactionnode(&List2, tempstring1);
- } }
- elif (!strcmp(contents[which].name, "INPT"))
- { chunkdesc("Input preferences", TRUE);
-
- // The first 16 bytes are a keymap, currently ignored
-
- if (!iff.raw)
- {
- label("Pointer sensitivity:");
- uvalue = getuword(&(contents[which].DataPtr[16]));
- unumcat(uvalue, FALSE);
- strcat(tempstring1, " ticks");
- addreactionnode(&List2, tempstring1);
-
- addreactionnode(&List2, "Double-click interval:");
-
- label(" Seconds:");
- uvalue = getulong(&(contents[which].DataPtr[18]));
- unumcat(uvalue, TRUE);
-
- label(" Microseconds:");
- uvalue = getulong(&(contents[which].DataPtr[22]));
- unumcat(uvalue, TRUE);
-
- addreactionnode(&List2, "Key repeat delay:");
-
- label(" Seconds:");
- uvalue = getulong(&(contents[which].DataPtr[26]));
- unumcat(uvalue, TRUE);
-
- label(" Microseconds:");
- uvalue = getulong(&(contents[which].DataPtr[30]));
- unumcat(uvalue, TRUE);
-
- addreactionnode(&List2, "Key repeat speed:");
-
- label(" Seconds:");
- uvalue = getulong(&(contents[which].DataPtr[34]));
- unumcat(uvalue, TRUE);
-
- label(" Microseconds:");
- uvalue = getulong(&(contents[which].DataPtr[38]));
- unumcat(uvalue, TRUE);
-
- label("Mouse acceleration:");
- svalue = getsword(&(contents[which].DataPtr[42]));
- snumcat(svalue, TRUE);
- } }
- elif (!strcmp(contents[which].name, "OSCN"))
- { chunkdesc("Overscan preferences", TRUE);
-
- if (!iff.raw)
- {
- label("Magic?");
- uvalue = getulong(&(contents[which].DataPtr[4]));
- if (uvalue == 0xFEDCBA89) // OSCAN_MAGIC
- { strcat(tempstring1, "Yes");
- } else
- { strcat(tempstring1, "No");
- }
- addreactionnode(&List2, tempstring1);
-
- label("Horizontal start:");
- uvalue = getuword(&(contents[which].DataPtr[8]));
- unumcat(uvalue, TRUE);
-
- label("Horizontal stop:");
- uvalue = getuword(&(contents[which].DataPtr[10]));
- unumcat(uvalue, TRUE);
-
- label("Vertical start:");
- uvalue = getuword(&(contents[which].DataPtr[12]));
- unumcat(uvalue, TRUE);
-
- label("Vertical stop:");
- uvalue = getuword(&(contents[which].DataPtr[14]));
- unumcat(uvalue, TRUE);
-
- label("DisplayID:");
- uvalue = getulong(&(contents[which].DataPtr[16]));
- unumcat(uvalue, TRUE);
-
- label("View offset:");
- svalue = getsword(&(contents[which].DataPtr[20]));
- snumcat(svalue, FALSE);
- strcat(tempstring1, ",");
- svalue = getsword(&(contents[which].DataPtr[22]));
- snumcat(svalue, TRUE);
-
- label("Text overscan size:");
- svalue = getsword(&(contents[which].DataPtr[24]));
- snumcat(svalue, FALSE);
- strcat(tempstring1, ",");
- svalue = getsword(&(contents[which].DataPtr[26]));
- snumcat(svalue, TRUE);
-
- addreactionnode(&List2, "Standard overscan size:");
-
- label(" Top-left corner:");
- svalue = getsword(&(contents[which].DataPtr[28]));
- snumcat(svalue, FALSE);
- strcat(tempstring1, ",");
- svalue = getsword(&(contents[which].DataPtr[30]));
- snumcat(svalue, TRUE);
-
- label(" Bottom-right corner:");
- svalue = getsword(&(contents[which].DataPtr[32]));
- snumcat(svalue, FALSE);
- strcat(tempstring1, ",");
- svalue = getsword(&(contents[which].DataPtr[34]));
- snumcat(svalue, TRUE);
- } }
- elif (!strcmp(contents[which].name, "SCRM"))
- { chunkdesc("Screen mode preferences", TRUE);
-
- if (!iff.raw)
- {
- label("DisplayID:");
- uvalue = getulong(&(contents[which].DataPtr[16]));
- unumcat(uvalue, TRUE);
-
- label("Screen width:");
- uvalue = getuword(&(contents[which].DataPtr[20]));
- unumcat(uvalue, TRUE);
-
- label("Screen height:");
- uvalue = getuword(&(contents[which].DataPtr[22]));
- unumcat(uvalue, TRUE);
-
- label("Screen depth:");
- uvalue = getuword(&(contents[which].DataPtr[24]));
- unumcat(uvalue, TRUE);
-
- label("Autoscroll?");
- uvalue = getuword(&(contents[which].DataPtr[26]));
- dobool((UBYTE) (uvalue & 1)); // SMB_AUTOSCROLL
- } }
- elif (!strcmp(contents[which].name, "PSPD"))
- { chunkdesc("PostScript printer preferences", TRUE);
-
- if (!iff.raw)
- { addreactionnode(&List2, "Global attributes:");
-
- label(" Driver mode:");
- interpret(10, (ULONG) contents[which].DataPtr[16]);
-
- label(" Paper format:");
- interpret(11, (ULONG) contents[which].DataPtr[17]);
-
- // now two reserved bytes
-
- label(" Copies:");
- svalue = getslong(&(contents[which].DataPtr[20]));
- snumcat(svalue, TRUE);
-
- label(" Paper width:");
- svalue = getslong(&(contents[which].DataPtr[24]));
- snumcat(svalue, FALSE);
- strcat(tempstring1, " millipoints");
- addreactionnode(&List2, tempstring1);
-
- label(" Paper height:");
- svalue = getslong(&(contents[which].DataPtr[28]));
- snumcat(svalue, FALSE);
- strcat(tempstring1, " millipoints");
- addreactionnode(&List2, tempstring1);
-
- label(" Horizontal DPI:");
- svalue = getslong(&(contents[which].DataPtr[32]));
- snumcat(svalue, FALSE);
- strcat(tempstring1, " millipoints");
- addreactionnode(&List2, tempstring1);
-
- label(" Vertical DPI:");
- svalue = getslong(&(contents[which].DataPtr[36]));
- snumcat(svalue, FALSE);
- strcat(tempstring1, " millipoints");
- addreactionnode(&List2, tempstring1);
-
- addreactionnode(&List2, "Text options:");
-
- label(" Font:");
- interpret(12, (ULONG) contents[which].DataPtr[40]);
-
- label(" Pitch:");
- interpret(13, (ULONG) contents[which].DataPtr[41]);
-
- label(" Orientation:");
- interpret(14, (ULONG) contents[which].DataPtr[42]);
-
- label(" Tab stops:");
- interpret(15, (ULONG) contents[which].DataPtr[43]);
-
- // now eight reserved bytes
-
- addreactionnode(&List2, "Text dimensions:");
-
- label(" Left margin:");
- svalue = getslong(&(contents[which].DataPtr[52]));
- snumcat(svalue, FALSE);
- strcat(tempstring1, " millipoints");
- addreactionnode(&List2, tempstring1);
-
- label(" Right margin:");
- svalue = getslong(&(contents[which].DataPtr[56]));
- snumcat(svalue, FALSE);
- strcat(tempstring1, " millipoints");
- addreactionnode(&List2, tempstring1);
-
- label(" Top margin:");
- svalue = getslong(&(contents[which].DataPtr[60]));
- snumcat(svalue, FALSE);
- strcat(tempstring1, " millipoints");
- addreactionnode(&List2, tempstring1);
-
- label(" Bottom margin:");
- svalue = getslong(&(contents[which].DataPtr[64]));
- snumcat(svalue, FALSE);
- strcat(tempstring1, " millipoints");
- addreactionnode(&List2, tempstring1);
-
- label(" Font size:");
- svalue = getslong(&(contents[which].DataPtr[68]));
- snumcat(svalue, FALSE);
- strcat(tempstring1, " millipoints");
- addreactionnode(&List2, tempstring1);
-
- label(" Leading:");
- svalue = getslong(&(contents[which].DataPtr[72]));
- snumcat(svalue, FALSE);
- strcat(tempstring1, " millipoints");
- addreactionnode(&List2, tempstring1);
-
- // now eight reserved bytes
-
- addreactionnode(&List2, "Graphics options:");
-
- label(" Left edge:");
- svalue = getslong(&(contents[which].DataPtr[80]));
- snumcat(svalue, FALSE);
- strcat(tempstring1, " millipoints");
- addreactionnode(&List2, tempstring1);
-
- label(" Top edge:");
- svalue = getslong(&(contents[which].DataPtr[84]));
- snumcat(svalue, FALSE);
- strcat(tempstring1, " millipoints");
- addreactionnode(&List2, tempstring1);
-
- label(" Width:");
- svalue = getslong(&(contents[which].DataPtr[88]));
- snumcat(svalue, FALSE);
- strcat(tempstring1, " millipoints");
- addreactionnode(&List2, tempstring1);
-
- label(" Height:");
- svalue = getslong(&(contents[which].DataPtr[92]));
- snumcat(svalue, FALSE);
- strcat(tempstring1, " millipoints");
- addreactionnode(&List2, tempstring1);
-
- label(" Image:");
- interpret(16, (ULONG) contents[which].DataPtr[96]);
-
- label(" Shading:");
- interpret(17, (ULONG) contents[which].DataPtr[97]);
-
- label(" Dithering:");
- interpret(18, (ULONG) contents[which].DataPtr[98]);
-
- // now nine reserved bytes
-
- addreactionnode(&List2, "Graphics scaling:");
-
- label(" Aspect:");
- interpret(19, (ULONG) contents[which].DataPtr[108]);
-
- label(" Scaling type:");
- interpret(20, (ULONG) contents[which].DataPtr[109]);
-
- // now one reserved byte
-
- label(" Centering:");
- interpret(21, (ULONG) contents[which].DataPtr[111]);
- } }
- elif (!strcmp(contents[which].name, "PGFX"))
- { chunkdesc("Printer graphics preferences", TRUE);
-
- if (!iff.raw)
- {
- label("Aspect:");
- uvalue = getuword(&(contents[which].DataPtr[16]));
- interpret(19, uvalue);
-
- label("Shading:");
- uvalue = getuword(&(contents[which].DataPtr[18]));
- interpret(22, uvalue);
-
- label("Image:");
- uvalue = getuword(&(contents[which].DataPtr[20]));
- interpret(16, uvalue);
-
- label("Threshold:");
- svalue = getsword(&(contents[which].DataPtr[22]));
- snumcat(svalue, TRUE);
-
- addreactionnode(&List2, "Colour correction:");
-
- label(" Red?");
- dobool(contents[which].DataPtr[24] & 1); // PCCF_RED
-
- label(" Green?");
- dobool(contents[which].DataPtr[24] & 2); // PCCF_GREEN
-
- label(" Blue?");
- dobool(contents[which].DataPtr[24] & 4); // PCCF_BLUE
-
- label("Dimensions:");
- interpret(23, (ULONG) contents[which].DataPtr[25]);
-
- label("Dithering:");
- interpret(24, (ULONG) contents[which].DataPtr[26]);
-
- label("Flags:");
- addreactionnode(&List2, tempstring1);
-
- uvalue = getuword(&(contents[which].DataPtr[27]));
-
- label(" Centre image?");
- dobool((UBYTE) (uvalue & 1)); // PGFF_CENTER_IMAGE
-
- label(" Integer scaling?");
- dobool((UBYTE) (uvalue & 2)); // PGFF_INTEGER_SCALING
-
- label(" Antialiasing?");
- dobool((UBYTE) (uvalue & 4)); // PGFF_ANTI_ALIAS
-
- label("Print density:");
- snumcat((SLONG) contents[which].DataPtr[29], FALSE);
- if (contents[which].DataPtr[29] < 1 || contents[which].DataPtr[29] > 7)
- { strcat(tempstring1, "!");
- }
- addreactionnode(&List2, tempstring1);
-
- label("Maximum width:");
- uvalue = getuword(&(contents[which].DataPtr[30]));
- unumcat(uvalue, TRUE);
-
- label("Maximum height:");
- uvalue = getuword(&(contents[which].DataPtr[32]));
- unumcat(uvalue, TRUE);
-
- label("Offset:");
- snumcat((SLONG) contents[which].DataPtr[34], FALSE);
- strcat(tempstring1, ",");
- snumcat((SLONG) contents[which].DataPtr[35], TRUE);
- } }
- elif (!strcmp(contents[which].name, "PTXT"))
- { chunkdesc("Printer text preferences", TRUE);
-
- if (!iff.raw)
- {
- label("Driver filename:");
- strcat(tempstring1, &(contents[which].DataPtr[16]));
- // 32-character field, so it doesn't need truncation
- addreactionnode(&List2, tempstring1);
-
- label("Port:");
- interpret(25, (ULONG) contents[which].DataPtr[48]);
-
- label("Paper type:");
- uvalue = getuword(&(contents[which].DataPtr[49]));
- interpret(26, uvalue);
-
- label("Paper size:");
- uvalue = getuword(&(contents[which].DataPtr[51]));
- interpret(27, uvalue);
-
- label("Paper length:");
- uvalue = getuword(&(contents[which].DataPtr[53]));
- unumcat(uvalue, FALSE);
- strcat(tempstring1, " lines");
- addreactionnode(&List2, tempstring1);
-
- label("Pitch:");
- uvalue = getuword(&(contents[which].DataPtr[55]));
- interpret(28, uvalue);
-
- label("Spacing:");
- uvalue = getuword(&(contents[which].DataPtr[57]));
- interpret(29, uvalue);
-
- label("Left margin:");
- uvalue = getuword(&(contents[which].DataPtr[59]));
- unumcat(uvalue, TRUE);
-
- label("Right margin:");
- uvalue = getuword(&(contents[which].DataPtr[61]));
- unumcat(uvalue, TRUE);
-
- label("Quality:");
- uvalue = getuword(&(contents[which].DataPtr[63]));
- interpret(30, uvalue);
- } }
- elif (!strcmp(contents[which].name, "SOND"))
- { chunkdesc("Sound preferences", TRUE);
-
- // 16 reserved bytes at start
-
- if (!iff.raw)
- { label("Flash display?");
- uvalue = getuword(&contents[which].DataPtr[16]); // BOOL
- dobool((UBYTE) uvalue);
-
- label("Make sounds?");
- uvalue = getuword(&contents[which].DataPtr[18]); // BOOL
- dobool((UBYTE) uvalue);
-
- label("Type of sound:");
- uvalue = getuword(&contents[which].DataPtr[20]); // UWORD
- interpret(31, uvalue);
-
- label("Volume:");
- uvalue = getuword(&contents[which].DataPtr[22]); // uword
- unumcat(uvalue, FALSE);
- if (uvalue > 64)
- { strcat(tempstring1, "!");
- }
- strcat(tempstring1, "/64");
- addreactionnode(&List2, tempstring1);
-
- label("Period:");
- uvalue = getuword(&contents[which].DataPtr[24]); // uword
- unumcat(uvalue, FALSE);
- if (uvalue < 127 || uvalue > 2500)
- { strcat(tempstring1, "!");
- }
- addreactionnode(&List2, tempstring1);
-
- label("Beep length:");
- uvalue = getuword(&contents[which].DataPtr[26]); // uword
- unumcat(uvalue, TRUE);
-
- label("Sample filename:");
- strcat(tempstring1, &contents[which].DataPtr[28]); // 256 chars
- addreactionnode(&List2, tempstring1);
- } }
- elif (!strcmp(contents[which].name, "PTRN"))
- { chunkdesc("Workbench pattern preferences", TRUE);
-
- // 16 reserved bytes at start
-
- if (!iff.raw)
- {
- label("Which pattern?");
- uvalue = getuword(&contents[which].DataPtr[16]); // UWORD
- interpret(32, uvalue);
-
- uvalue = getuword(&contents[which].DataPtr[18]); // UWORD
-
- label("Data contains pattern?");
- dobool((UBYTE) (uvalue & 1)); // WBPF_PATTERN
-
- label("Remap pattern?"); // note that this one is inverted
- if (uvalue & 16) // WBPF_NOREMAP
- { strcat(tempstring1, "No");
- } else
- { strcat(tempstring1, "Yes");
- }
- addreactionnode(&List2, tempstring1);
-
- label("Dither quality:");
- if (uvalue & 768) // these comparisons are order-dependent
- { strcat(tempstring1, "Best");
- } elif (uvalue & 512)
- { strcat(tempstring1, "Good");
- } elif (uvalue & 256)
- { strcat(tempstring1, "Poor");
- } else
- { strcat(tempstring1, "Default");
- }
- addreactionnode(&List2, tempstring1);
-
- label("Colour quality:");
- if (uvalue & 3072) // these comparisons are order-dependent
- { strcat(tempstring1, "Best");
- } elif (uvalue & 2048)
- { strcat(tempstring1, "Good");
- } elif (uvalue & 1024)
- { strcat(tempstring1, "Poor");
- } else
- { strcat(tempstring1, "Default");
- }
- addreactionnode(&List2, tempstring1);
-
- label("Layout:");
- if (uvalue & 12288) // these comparisons are order-dependent
- { strcat(tempstring1, "Scale well");
- } elif (uvalue & 8192)
- { strcat(tempstring1, "Scale");
- } elif (uvalue & 4096)
- { strcat(tempstring1, "Centre");
- } else
- { strcat(tempstring1, "Tile");
- }
- addreactionnode(&List2, tempstring1);
-
- label("Revision:"); // BYTE
- snumcat((SLONG) contents[which].DataPtr[20], TRUE);
-
- label("Pattern depth:"); // BYTE
- snumcat((SLONG) contents[which].DataPtr[21], TRUE);
-
- label("Data length:"); // UWORD
- uvalue = getuword(&contents[which].DataPtr[22]);
- unumcat(uvalue, TRUE);
- } }
- elif (!strcmp(contents[which].name, "PNTR"))
- { chunkdesc("Pointer preferences", TRUE);
-
- // 16 reserved bytes at start
-
- if (!iff.raw)
- { label("Which pointer?");
- uvalue = getuword(&contents[which].DataPtr[16]); // UWORD
- interpret(33, uvalue);
-
- label("Horizontal size:");
- uvalue = getuword(&contents[which].DataPtr[18]); // UWORD
- interpret(34, uvalue);
-
- label("Width:");
- uvalue = getuword(&contents[which].DataPtr[20]); // UWORD
- unumcat(uvalue, FALSE);
- strcat(tempstring1, " pixels");
- addreactionnode(&List2, tempstring1);
-
- label("Height:");
- uvalue = getuword(&contents[which].DataPtr[22]); // UWORD
- unumcat(uvalue, FALSE);
- strcat(tempstring1, " pixels");
- addreactionnode(&List2, tempstring1);
-
- label("Depth:");
- uvalue = getuword(&contents[which].DataPtr[24]); // UWORD
- unumcat(uvalue, FALSE);
- strcat(tempstring1, " planes");
- addreactionnode(&List2, tempstring1);
-
- label("Vertical size:");
- uvalue = getuword(&contents[which].DataPtr[26]); // UWORD
- interpret(35, uvalue);
-
- label("Hotspot coordinates:");
- uvalue = getuword(&contents[which].DataPtr[28]); // UWORD
- unumcat(uvalue, FALSE);
- strcat(tempstring1, ",");
- uvalue = getuword(&contents[which].DataPtr[30]); // UWORD
- unumcat(uvalue, TRUE);
- } }
- elif (!strcmp(contents[which].name, "PALT")) // ignored
- { chunkdesc("Palette preferences", FALSE);
- } elif (!strcmp(contents[which].name, "AHIG"))
- { chunkdesc("AHI global preferences", TRUE);
-
- if (!iff.raw)
- { label("Debug level:");
- uvalue = getuword(contents[which].DataPtr); // UWORD
- interpret(36, uvalue);
-
- label("Disable surround sound?");
- uvalue = getuword(&contents[which].DataPtr[2]); // BOOL
- dobool((UBYTE) uvalue);
-
- label("Disable echo?");
- uvalue = getuword(&contents[which].DataPtr[4]); // BOOL
- dobool((UBYTE) uvalue);
-
- label("Fast echo?");
- uvalue = getuword(&contents[which].DataPtr[6]); // BOOL
- dobool((UBYTE) uvalue);
-
- label("Maximum CPU usage:");
- svalue = getslong(&(contents[which].DataPtr[8]));
- svalue /= 1024; // LONG (Fixed)
- snumcat(svalue, FALSE);
- strcat(tempstring1, "/64");
- addreactionnode(&List2, tempstring1);
-
- label("Clip master volume?");
- uvalue = getuword(&contents[which].DataPtr[12]); // BOOL
- dobool((UBYTE) uvalue);
- } }
- elif (!strcmp(contents[which].name, "AHIU"))
- { chunkdesc("AHI unit preferences", TRUE);
-
- if (!iff.raw)
- { label("Unit:");
- snumcat((SLONG) contents[which].DataPtr[0], TRUE); // UBYTE
-
- // byte 1 is a pad byte
-
- label("Channels:");
- uvalue = getuword(&contents[which].DataPtr[2]); // UWORD
- unumcat(uvalue, TRUE);
-
- label("Audio mode:");
- uvalue = getuword(&contents[which].DataPtr[4]); // ULONG
- unumcat(uvalue, TRUE); // perhaps this can be interpreted?
-
- label("Frequency:");
- uvalue = getuword(&contents[which].DataPtr[8]); // ULONG
- unumcat(uvalue, TRUE);
-
- label("Monitor volume:");
- svalue = getslong(&(contents[which].DataPtr[12]));
- svalue /= 1024; // LONG (Fixed)
- snumcat(svalue, FALSE);
- strcat(tempstring1, "/64");
- addreactionnode(&List2, tempstring1);
-
- label("Input gain:");
- svalue = getslong(&(contents[which].DataPtr[16]));
- svalue /= 1024; // LONG (Fixed)
- snumcat(svalue, FALSE);
- strcat(tempstring1, "/64");
- addreactionnode(&List2, tempstring1);
-
- label("Output volume:");
- svalue = getslong(&(contents[which].DataPtr[20]));
- svalue /= 1024; // LONG (Fixed)
- snumcat(svalue, FALSE);
- strcat(tempstring1, "/64");
- addreactionnode(&List2, tempstring1);
-
- label("Input:");
- uvalue = getuword(&contents[which].DataPtr[24]); // ULONG
- unumcat(uvalue, TRUE); // perhaps this can be interpreted?
-
- label("Output:");
- uvalue = getuword(&contents[which].DataPtr[28]); // ULONG
- unumcat(uvalue, TRUE); // perhaps this can be interpreted?
- } }
- elif (!strcmp(contents[which].name, "WBNC"))
- { chunkdesc("Workbench preferences", TRUE);
-
- if (!iff.raw)
- {
- label("Default stack size:");
- uvalue = getulong(contents[which].DataPtr); // ULONG
- unumcat(uvalue, FALSE);
- strcat(tempstring1, " bytes");
- addreactionnode(&List2, tempstring1);
-
- label("Type restart time:");
- uvalue = getulong(&contents[which].DataPtr[4]); // ULONG
- unumcat(uvalue, FALSE);
- strcat(tempstring1, " seconds");
- addreactionnode(&List2, tempstring1);
-
- label("Icon precision:");
- uvalue = getulong(&contents[which].DataPtr[8]); // ULONG
- if (uvalue == (ULONG) -1) // PRECISION_EXACT
- { strcat(tempstring1, "-1 (exact)");
- } elif (uvalue == 0) // PRECISION_IMAGE
- { strcat(tempstring1, "0 (image)");
- } elif (uvalue == 16) // PRECISION_ICON
- { strcat(tempstring1, "16 (icon)");
- } elif (uvalue == 32) // PRECISION_GUI
- { strcat(tempstring1, "32 (GUI)");
- } else
- { strcat(tempstring1, "?");
- }
- addreactionnode(&List2, tempstring1);
-
- addreactionnode(&List2, "Emboss rectangle:");
-
- label(" Top-left corner:");
- svalue = getsword(&contents[which].DataPtr[12]); // WORD
- snumcat(svalue, FALSE);
- strcat(tempstring1, ",");
- svalue = getuword(&contents[which].DataPtr[14]); // WORD
- snumcat(svalue, TRUE);
-
- label(" Bottom-right corner:");
- svalue = getsword(&contents[which].DataPtr[16]); // WORD
- snumcat(svalue, FALSE);
- strcat(tempstring1, ",");
- svalue = getuword(&contents[which].DataPtr[18]); // WORD
- snumcat(svalue, TRUE);
-
- label("Borderless?");
- uvalue = getuword(&contents[which].DataPtr[20]); // BOOL
- dobool((UBYTE) uvalue);
-
- label("Max. filename length:");
- svalue = getslong(&contents[which].DataPtr[22]); // LONG
- snumcat(svalue, FALSE);
- strcat(tempstring1, " characters");
- addreactionnode(&List2, tempstring1);
-
- label("NewIcons support?");
- uvalue = getuword(&contents[which].DataPtr[26]); // BOOL
- dobool((UBYTE) uvalue);
-
- label("ColourIcons support?");
- uvalue = getuword(&contents[which].DataPtr[28]); // BOOL
- dobool((UBYTE) uvalue);
-
- // remainder of these are new for OS3.9
-
- if (contents[which].bytes > 30)
- { label("Image memory type:");
- uvalue = getulong(&contents[which].DataPtr[30]); // ULONG
- if (uvalue == 1)
- { strcat(tempstring1, "1 (Other memory)");
- } elif (uvalue == 2)
- { strcat(tempstring1, "2 (Graphics (chip) memory)");
- } else
- { strcat(tempstring1, "?");
- }
- addreactionnode(&List2, tempstring1);
-
- label("Lock pens?");
- uvalue = getuword(&contents[which].DataPtr[34]); // BOOL
- dobool((UBYTE) uvalue);
-
- label("Title bar?"); // this one is inverted
- uvalue = getuword(&contents[which].DataPtr[36]); // BOOL
- if (uvalue)
- { strcat(tempstring1, "No");
- } else
- { strcat(tempstring1, "Yes");
- }
- addreactionnode(&List2, tempstring1);
-
- label("Volume gauge?"); // this one is inverted
- uvalue = getuword(&contents[which].DataPtr[38]); // BOOL
- if (uvalue)
- { strcat(tempstring1, "No");
- } else
- { strcat(tempstring1, "Yes");
- }
- addreactionnode(&List2, tempstring1);
- } } }
- elif (!strcmp(contents[which].name, "WBHD"))
- { chunkdesc("Workbench hidden device preferences", TRUE);
-
- if (!iff.raw)
- { label("Name:");
- strcat(tempstring1, contents[which].DataPtr);
- addreactionnode(&List2, tempstring1);
- } }
- elif (!strcmp(contents[which].name, "LCLE"))
- { chunkdesc("Locale preferences", TRUE);
-
- // 16 reserved bytes at start
-
- if (!iff.raw)
- { label("Country name:");
- strcat(tempstring1, &contents[which].DataPtr[16]); // 32 chars
- addreactionnode(&List2, tempstring1);
-
- label("Preferred languages:");
- addreactionnode(&List2, tempstring1);
-
- for (i = 1; i <= 10; i++)
- { strcpy(tempstring3, " ");
- if (i < 10)
- { strcat(tempstring3, " ");
- }
- stcl_d(tempstring2, i);
- strcat(tempstring3, tempstring2);
- strcat(tempstring3, ":");
- label(tempstring3);
- strcat(tempstring1, &contents[which].DataPtr[48 + ((i - 1) * 30)]); // 10 entries of 30 chars each
- addreactionnode(&List2, tempstring1);
- }
-
- label("Time from GMT:");
- svalue = getslong(&contents[which].DataPtr[348]); // LONG
- snumcat(svalue, FALSE);
- strcat(tempstring1, " minutes");
- addreactionnode(&List2, tempstring1);
-
- label("Flags:");
- uvalue = getulong(&contents[which].DataPtr[352]); // ULONG
- unumcat(uvalue, TRUE);
-
- docountry(&contents[which].DataPtr[356]);
- } }
- elif (!strcmp(contents[which].name, "CTRY"))
- { chunkdesc("Country preferences", TRUE);
-
- if (!iff.raw)
- { docountry(contents[which].DataPtr);
- } }
- elif (!strcmp(contents[which].name, "RACT"))
- { chunkdesc("ReAction preferences", TRUE);
-
- if (!iff.raw)
- {
- label("Bevel type:"); // UWORD
- uvalue = getuword(contents[which].DataPtr);
- interpret(37, uvalue);
-
- label("Glyph type:"); // UWORD
- uvalue = getuword(&contents[which].DataPtr[2]);
- interpret(38, uvalue);
-
- label("Layout spacing:"); // UWORD
- uvalue = getuword(&contents[which].DataPtr[4]);
- unumcat(uvalue, TRUE);
-
- label("3D Proportional?");
- uvalue = getuword(&contents[which].DataPtr[6]); // BOOL
- dobool((UBYTE) uvalue);
-
- label("Label pen:"); // UWORD
- uvalue = getuword(&contents[which].DataPtr[8]);
- unumcat(uvalue, TRUE);
-
- label("Label placement:"); // UWORD
- uvalue = getuword(&contents[which].DataPtr[10]);
- /* This has been reverse-engineered
- using the ReAction preferences editor */
- interpret(39, uvalue);
-
- label("3D Label?");
- uvalue = getuword(&contents[which].DataPtr[12]); // BOOL
- dobool((UBYTE) uvalue);
-
- label("Refreshing Method:");
- uvalue = getuword(&contents[which].DataPtr[14]); // BOOL
- if (uvalue)
- { strcat(tempstring1, "Simple");
- } else
- { strcat(tempstring1, "Smart");
- }
- addreactionnode(&List2, tempstring1);
-
- label("3D Look?");
- uvalue = getuword(&contents[which].DataPtr[16]); // BOOL
- dobool((UBYTE) uvalue);
-
- addreactionnode(&List2, "Fallback font:");
- dotextattr(&contents[which].DataPtr[18]); // struct TextAttr (8 bytes)
- addreactionnode(&List2, "Label font:");
- dotextattr(&contents[which].DataPtr[26]); // struct TextAttr (8 bytes)
-
- label("Fallback font name:");
- strcat(tempstring1, &contents[which].DataPtr[34]); // 128 UBYTEs
- addreactionnode(&List2, tempstring1);
-
- label("Label font name:");
- strcat(tempstring1, &contents[which].DataPtr[162]); // 128 UBYTEs
- addreactionnode(&List2, tempstring1);
-
- label("Backdrop pattern:");
- strcat(tempstring1, &contents[which].DataPtr[290]); // 256 UBYTEs
- addreactionnode(&List2, tempstring1);
- } }
- elif (!strcmp(contents[which].name, "PRHD"))
- { chunkdesc("Preferences header", TRUE);
-
- if (!iff.raw)
- { label("Version:");
- snumcat((SLONG) contents[which].DataPtr[0], TRUE);
-
- label("Type:");
- snumcat((SLONG) contents[which].DataPtr[1], TRUE);
-
- label("Flags:");
- uvalue = getuword(&(contents[which].DataPtr[2]));
- unumcat(uvalue, TRUE);
- } } }
- elif (!strcmp(queryform, "SMUS"))
- { if (!strcmp(contents[which].name, "SHDR"))
- { chunkdesc("Global information for the score", TRUE);
-
- if (!iff.raw)
- {
- label("Tempo:");
- uvalue = getuword(contents[which].DataPtr);
- uvalue /= 128;
- unumcat(uvalue, FALSE);
- strcat(tempstring1, " bpm");
- addreactionnode(&List2, tempstring1);
-
- label("Volume:");
- snumcat((SLONG) contents[which].DataPtr[2], FALSE);
- strcat(tempstring1, "/127");
- addreactionnode(&List2, tempstring1);
-
- label("Tracks:");
- snumcat((SLONG) contents[which].DataPtr[3], TRUE);
- } }
- elif (!strcmp(contents[which].name, "INS1"))
- { chunkdesc("Identifies an instrument to use", TRUE);
-
- if (!iff.raw)
- {
- label("Register number:");
- snumcat((SLONG) contents[which].DataPtr[0], TRUE); // UBYTE
-
- label("Reference type:");
- interpret(40, (ULONG) contents[which].DataPtr[1]); // UBYTE
-
- label("MIDI channel:");
- if (contents[which].DataPtr[1] == 1) // if find on MIDI
- { snumcat((SLONG) contents[which].DataPtr[2], TRUE); // UBYTE
- } else
- { strcat(tempstring1, "n/a");
- addreactionnode(&List2, tempstring1);
- }
-
- label("MIDI preset:");
- if (contents[which].DataPtr[1] == 1) // if find on MIDI
- { snumcat((SLONG) contents[which].DataPtr[3], TRUE);
- } else
- { strcat(tempstring1, "n/a");
- addreactionnode(&List2, tempstring1);
- }
-
- label("Instrument name:");
- strcat(tempstring1, (STRPTR) contents[which].DataPtr + 4); // STRPTR
- addreactionnode(&List2, tempstring1);
- } }
- elif (!strcmp(contents[which].name, "TRAK"))
- { chunkdesc("Linear stream of events", FALSE);
- } elif (!strcmp(contents[which].name, "INST"))
- { chunkdesc("Obsolete; use INS1 instead", FALSE);
- } elif (!stricmp(contents[which].name, "IRev")) // this could also perhaps be IREV
- { chunkdesc("Instant Music private chunk", FALSE);
- } elif (!strcmp(contents[which].name, "BIAS"))
- { chunkdesc("Instant Music private chunk", FALSE);
- } }
- elif (!strcmp(queryform, "HEAD"))
- { if (!strcmp(contents[which].name, "NEST"))
- { chunkdesc("Nesting level", TRUE);
-
- if (!iff.raw)
- { label("Nesting level:");
- uvalue = getuword(contents[which].DataPtr);
- unumcat(uvalue, TRUE);
- } }
- elif (!strcmp(contents[which].name, "TEXT"))
- { chunkdesc("Heading text", FALSE);
- } }
- elif (!strcmp(queryform, "WORD"))
- { if (!strcmp(contents[which].name, "FONT"))
- { chunkdesc("Font name/number table", TRUE);
-
- if (!iff.raw)
- { label("Number:");
- snumcat((SLONG) contents[which].DataPtr[0], TRUE); // UBYTE
-
- label("Size:");
- uvalue = getuword(&contents[which].DataPtr[1]);
- unumcat(uvalue, TRUE);
-
- label("Name:");
- strcat(tempstring1, &contents[which].DataPtr[3]);
- addreactionnode(&List2, tempstring1);
- } }
- elif (!strcmp(contents[which].name, "COLR"))
- { chunkdesc("Colour translation table", TRUE);
-
- if (!iff.raw)
- { for (i = 0; i <= 7; i++)
- { strcpy(tempstring3, "Colour ");
- stcl_d(tempstring2, i);
- strcat(tempstring3, tempstring2);
- strcat(tempstring3, ":");
- label(tempstring3);
- snumcat((SLONG) contents[which].DataPtr[i], TRUE);
- } } }
- elif (!strcmp(contents[which].name, "DOC "))
- { chunkdesc("Begin document section", TRUE);
-
- if (!iff.raw)
- { label("Starting page:");
- uvalue = getuword(contents[which].DataPtr);
- unumcat(uvalue, TRUE);
-
- label("Numbering style:");
- interpret(41, (ULONG) contents[which].DataPtr[2]);
- } }
- elif (!strcmp(contents[which].name, "HEAD"))
- { chunkdesc("Begin header section", TRUE);
-
- if (!iff.raw)
- { label("Page type:");
- interpret(42, (ULONG) contents[which].DataPtr[0]);
-
- label("First page?");
- dobool(contents[which].DataPtr[1]);
- } }
- elif (!strcmp(contents[which].name, "FOOT"))
- { chunkdesc("Begin footer section", TRUE);
-
- if (!iff.raw)
- { label("Page type:");
- interpret(42, (ULONG) contents[which].DataPtr[0]);
-
- label("First page?");
- dobool(contents[which].DataPtr[1]);
- } }
- elif (!strcmp(contents[which].name, "PCTS"))
- { chunkdesc("Begin picture section", TRUE);
-
- if (!iff.raw)
- { label("Bitplanes:");
- snumcat((SLONG) contents[which].DataPtr[0], TRUE); // UBYTE
- } }
- elif (!strcmp(contents[which].name, "PARA"))
- { chunkdesc("New paragraph format", TRUE);
-
- if (!iff.raw)
- { label("Left indent:");
- uvalue = getuword(contents[which].DataPtr); // UWORD
- unumcat(uvalue, FALSE);
- strcat(tempstring1, " decipoints");
- addreactionnode(&List2, tempstring1);
-
- label("Left margin:");
- uvalue = getuword(&(contents[which].DataPtr[2])); // UWORD
- unumcat(uvalue, FALSE);
- strcat(tempstring1, " decipoints");
- addreactionnode(&List2, tempstring1);
-
- label("Right margin:");
- uvalue = getuword(&(contents[which].DataPtr[4])); // UWORD
- unumcat(uvalue, FALSE);
- strcat(tempstring1, " decipoints");
- addreactionnode(&List2, tempstring1);
-
- label("Line spacing:");
- if (contents[which].DataPtr[6] == 0)
- { strcat(tempstring1, "Single");
- } elif (contents[which].DataPtr[6] == 16)
- { strcat(tempstring1, "Double");
- } else
- { strcat(tempstring1, "?");
- }
- addreactionnode(&List2, tempstring1);
-
- label("Justification:");
- interpret(43, (ULONG) contents[which].DataPtr[7]);
-
- label("Font number:");
- uvalue = contents[which].DataPtr[8]; // UBYTE
- unumcat(uvalue, TRUE);
-
- addreactionnode(&List2, " Style:");
-
- label(" Underlined?");
- dobool(contents[which].DataPtr[9] & 1);
-
- label(" Bold?");
- dobool(contents[which].DataPtr[9] & 2);
-
- label(" Italic?");
- dobool(contents[which].DataPtr[9] & 4);
-
- label(" Extended?");
- dobool(contents[which].DataPtr[9] & 8);
-
- label(" ColourFont?");
- dobool(contents[which].DataPtr[9] & 64);
-
- label(" Tagged?");
- dobool(contents[which].DataPtr[9] & 128);
-
- label("Miscellaneous style:");
- interpret(1, (ULONG) contents[which].DataPtr[10]);
-
- label("Colour:");
- uvalue = contents[which].DataPtr[11]; // UBYTE
- unumcat(uvalue, TRUE);
- } }
- elif (!strcmp(contents[which].name, "TABS"))
- { chunkdesc("New tab stop types/locations", TRUE);
-
- if (!iff.raw)
- { label("Position:");
- uvalue = getuword(contents[which].DataPtr); // UWORD
- unumcat(uvalue, FALSE);
- strcat(tempstring1, " decipoints");
- addreactionnode(&List2, tempstring1);
-
- label("Type:");
- interpret(44, (ULONG) contents[which].DataPtr[2]);
- } }
- elif (!strcmp(contents[which].name, "PAGE"))
- { chunkdesc("Page break", FALSE);
- } elif (!strcmp(contents[which].name, "TEXT"))
- { chunkdesc("Paragraph text", FALSE);
- } elif (!strcmp(contents[which].name, "PINF"))
- { chunkdesc("Picture info", TRUE);
-
- if (!iff.raw)
- { label("Width:");
- uvalue = getuword(contents[which].DataPtr); // UWORD
- unumcat(uvalue, TRUE);
-
- label("Height:");
- uvalue = getuword(&(contents[which].DataPtr[2])); // UWORD
- unumcat(uvalue, TRUE);
-
- label("Page:");
- uvalue = getuword(&(contents[which].DataPtr[4])); // UWORD
- unumcat(uvalue, TRUE);
-
- label("X-position:");
- uvalue = getuword(&(contents[which].DataPtr[6])); // UWORD
- unumcat(uvalue, FALSE);
- strcat(tempstring1, " decipoints");
- addreactionnode(&List2, tempstring1);
-
- label("Y-position:");
- uvalue = getuword(&(contents[which].DataPtr[8])); // UWORD
- unumcat(uvalue, FALSE);
- strcat(tempstring1, " decipoints");
- addreactionnode(&List2, tempstring1);
-
- label("Masking:");
- interpret(45, (ULONG) contents[which].DataPtr[10]);
-
- label("Compression:");
- interpret(46, (ULONG) contents[which].DataPtr[11]);
-
- label("Transparent colour:");
- if (contents[which].DataPtr[10] != 2
- && contents[which].DataPtr[10] != 3)
- { strcat(tempstring1, "n/a");
- addreactionnode(&List2, tempstring1);
- } else
- { uvalue = getuword(&(contents[which].DataPtr[12])); // UWORD
- unumcat(uvalue, TRUE);
- }
- } } }
- elif (!strcmp(queryform, "AIFF"))
- { if (!strcmp(contents[which].name, "MIDI"))
- { chunkdesc("Stores MIDI data", FALSE);
- } elif (!strcmp(contents[which].name, "MARK"))
- { chunkdesc("Points to positions in the sound data", TRUE);
-
- if (!iff.raw)
- { label("Markers:");
-
- svalue = getsword(contents[which].DataPtr);
- snumcat(svalue, FALSE);
- if (svalue < 0)
- { strcat(tempstring1, "!");
- }
- addreactionnode(&List2, tempstring1);
- markers = svalue;
- if (markers > 0)
- { currentpos = 2;
- for (i = 1; i <= markers; i++)
- { strcpy(tempstring3, "Marker ");
- stcl_d(tempstring2, i);
- strcat(tempstring3, tempstring2);
- strcat(tempstring3, ":");
- label(tempstring3);
- addreactionnode(&List2, tempstring1);
-
- label(" ID:");
- svalue = getsword(&(contents[which].name[currentpos]));
- snumcat(svalue, FALSE);
- if (svalue < 1)
- { strcat(tempstring1, "!");
- }
- addreactionnode(&List2, tempstring1);
- currentpos += 2;
-
- label(" Position:");
- uvalue = getulong(&(contents[which].name[currentpos]));
- unumcat(uvalue, TRUE);
- currentpos += 4;
-
- label(" Name:");
- uvalue = contents[which].name[currentpos++];
- // the number of characters in the string
- if (uvalue < MEDFIELD)
- { strncat(tempstring1, &(contents[which].name[currentpos]), uvalue);
- } else
- { strncat(tempstring1, &(contents[which].name[currentpos]), MEDFIELD);
- }
- addreactionnode(&List2, tempstring1);
- currentpos += uvalue;
- if (uvalue % 2)
- { currentpos++; // skip pad byte, if appropriate
- } } } } }
- elif (!strcmp(contents[which].name, "AESD"))
- { chunkdesc("Pertinent to autio recording devices", FALSE);
- } elif (!strcmp(contents[which].name, "COMT"))
- { chunkdesc("Stores comments", TRUE);
-
- if (!iff.raw)
- { label("Comments:");
- svalue = getsword(contents[which].DataPtr);
- snumcat(svalue, FALSE);
- if (svalue < 0)
- { strcat(tempstring1, "!");
- }
- addreactionnode(&List2, tempstring1);
-
- // we could have a 'comments' variable, but we just reuse
- // the 'markers' variable.
- markers = svalue;
- if (markers > 0)
- { currentpos = 2;
- for (i = 1; i <= markers; i++)
- { strcpy(tempstring3, "Comment ");
- stcl_d(tempstring2, i);
- strcat(tempstring3, tempstring2);
- strcat(tempstring3, ":");
- label(tempstring3);
- addreactionnode(&List2, tempstring1);
-
- label(" Created on:");
- uvalue = getulong(&(contents[which].DataPtr[currentpos]));
- DateTime.dat_Stamp.ds_Days = uvalue / 86400; // days since 1/1/78
- DateTime.dat_Stamp.ds_Minute = (uvalue % 86400) / 60; // minutes in day
- DateTime.dat_Stamp.ds_Tick = ((uvalue % 86400) % 60) * 50; // ticks in minute
- DateTime.dat_Format = FORMAT_DOS;
- DateTime.dat_Flags = DTF_SUBST;
- DateTime.dat_StrDay = weekdaystring;
- DateTime.dat_StrDate = datestring;
- DateTime.dat_StrTime = timestring;
- if (!DateToStr(&DateTime))
- { rq("DateToStr() failed!");
- }
- strcat(tempstring1, timestring);
- strcat(tempstring1, " ");
- strcat(tempstring1, weekdaystring);
- strcat(tempstring1, " ");
- strcat(tempstring1, datestring);
- addreactionnode(&List2, tempstring1);
- currentpos += 4;
-
- label(" Marker ID:");
- svalue = getsword(&(contents[which].DataPtr[currentpos]));
- snumcat(svalue, FALSE);
- if (svalue < 1)
- { strcat(tempstring1, "!");
- }
- addreactionnode(&List2, tempstring1);
- currentpos += 2;
-
- label(" Comment:");
- uvalue = getuword(&(contents[which].DataPtr[currentpos]));
- // the number of characters in the string
- currentpos += 2;
- if (uvalue < MEDFIELD)
- { strncat(tempstring1, &(contents[which].name[currentpos]), uvalue);
- } else
- { strncat(tempstring1, &(contents[which].name[currentpos]), MEDFIELD);
- }
- addreactionnode(&List2, tempstring1);
- currentpos += uvalue;
- if (uvalue % 2)
- { currentpos++; // skip pad byte, if appropriate
- } } } } }
- elif (!strcmp(contents[which].name, "COMM"))
- { chunkdesc("Fundamental parameters for the sampled sound", TRUE);
-
- if (!iff.raw)
- { label("Channels:");
- svalue = getsword(contents[which].DataPtr);
- snumcat(svalue, FALSE);
- if (svalue == 1)
- { strcat(tempstring1, " (mono)");
- } elif (svalue == 2)
- { strcat(tempstring1, " (stereo)");
- } elif (svalue > 2)
- { strcat(tempstring1, " (surround)");
- }
- addreactionnode(&List2, tempstring1);
-
- label("Sample frames:");
- uvalue = getulong(&(contents[which].DataPtr[2]));
- unumcat(uvalue, TRUE);
-
- label("Sample quality:");
- svalue = getsword(&(contents[which].DataPtr[6]));
- snumcat(svalue, FALSE);
- strcat(tempstring1, "-bit");
- addreactionnode(&List2, tempstring1);
-
- /* Now there is an 80-bit (10-byte) IEEE 754 Apple-style
- (SANE) floating point number (not yet implemented):
- 79 Sign
- 64:78 Exponent
- 0:63 Mantissa */
-
- label("Playback rate:");
- strcat(tempstring1, "-");
- addreactionnode(&List2, tempstring1);
- } }
- elif (!strcmp(contents[which].name, "APPL"))
- { chunkdesc("Application-specific data", TRUE);
-
- if (!iff.raw)
- { label("Application:");
- strcat(tempstring1, contents[which].DataPtr);
- if (!strcmp(tempstring1, "pdos"))
- { strcat(tempstring1, " (Apple II)");
- }
- addreactionnode(&List2, tempstring1);
- } }
- elif (!strcmp(contents[which].name, "SSND"))
- { chunkdesc("The actual sample frames", TRUE);
-
- if (!iff.raw)
- { label("Offset:");
- uvalue = getulong(contents[which].DataPtr);
- unumcat(uvalue, TRUE);
-
- label("Block size:");
- uvalue = getulong(&(contents[which].DataPtr[4]));
- unumcat(uvalue, TRUE);
- } }
- elif (!strcmp(contents[which].name, "INST"))
- { chunkdesc("Instrument chunk", TRUE);
-
- if (!iff.raw)
- { label("Base note:");
- svalue = getsbyte(&(contents[which].DataPtr[0]));
- snumcat(svalue, FALSE);
- if (svalue < 0 || svalue > 127)
- strcat(tempstring1, "!");
- addreactionnode(&List2, tempstring1);
-
- label("Detune:");
- svalue = getsbyte(&(contents[which].DataPtr[1]));
- snumcat(svalue, FALSE);
- if (svalue < -50 || svalue > 50)
- strcat(tempstring1, "!");
- addreactionnode(&List2, tempstring1);
-
- label("Low note:");
- svalue = getsbyte(&(contents[which].DataPtr[2]));
- snumcat(svalue, FALSE);
- if (svalue < 0 || svalue > 127) // actually these couldn't be >127
- strcat(tempstring1, "!");
- addreactionnode(&List2, tempstring1);
-
- label("High note:");
- svalue = getsbyte(&(contents[which].DataPtr[3]));
- snumcat(svalue, FALSE);
- if (svalue < 0 || svalue > 127)
- strcat(tempstring1, "!");
- addreactionnode(&List2, tempstring1);
-
- label("Low velocity:");
- svalue = getsbyte(&(contents[which].DataPtr[4]));
- snumcat(svalue, FALSE);
- if (svalue < 1 || svalue > 127)
- strcat(tempstring1, "!");
- addreactionnode(&List2, tempstring1);
-
- label("High velocity:");
- svalue = getsbyte(&(contents[which].DataPtr[5]));
- snumcat(svalue, FALSE);
- if (svalue < 1 || svalue > 127)
- strcat(tempstring1, "!");
- addreactionnode(&List2, tempstring1);
-
- label("Gain:");
- svalue = getsword(&(contents[which].DataPtr[6]));
- snumcat(svalue, TRUE);
-
- label("Sustain loop:");
- svalue = getsword(&(contents[which].DataPtr[8]));
- interpret(47, (ULONG) svalue);
-
- label(" Begin loop:");
- svalue = getsword(&(contents[which].DataPtr[10]));
- snumcat(svalue, TRUE);
-
- label(" End loop:");
- svalue = getsword(&(contents[which].DataPtr[12]));
- snumcat(svalue, TRUE);
-
- label("Release loop:");
- svalue = getsword(&(contents[which].DataPtr[14]));
- interpret(47, (ULONG) svalue);
-
- label(" Begin loop:");
- svalue = getsword(&(contents[which].DataPtr[16]));
- snumcat(svalue, TRUE);
-
- label(" End loop:");
- svalue = getsword(&(contents[which].DataPtr[18]));
- snumcat(svalue, TRUE);
- } } }
- elif (!strcmp(queryform, "CTLG"))
- { if (!strcmp(contents[which].name, "LANG"))
- { chunkdesc("Language", TRUE);
-
- if (!iff.raw)
- { label("Language:");
- strcat(tempstring1, contents[which].DataPtr);
- addreactionnode(&List2, tempstring1);
- } }
- // CSET chunk (32 bytes), STRS chunk?
- } elif (!strcmp(queryform, "8SVX"))
- { if (!strcmp(contents[which].name, "ATAK"))
- { chunkdesc("Gives attack amplitude contour (envelope)", FALSE);
- } elif (!strcmp(contents[which].name, "RLSE"))
- { chunkdesc("Gives release amplitude contour (envelope)", FALSE);
- } elif (!strcmp(contents[which].name, "BODY"))
- { chunkdesc("Sound data chunk", FALSE);
- } elif (!strcmp(contents[which].name, "FADE"))
- { chunkdesc("Fade away to silence", TRUE);
-
- if (!iff.raw)
- { label("Fade start:");
- uvalue = getulong(contents[which].DataPtr);
- unumcat(uvalue, TRUE);
- } }
- elif (!strcmp(contents[which].name, "SEQN"))
- { chunkdesc("Multiple loop sequencing", TRUE);
-
- if (!iff.raw)
- {
- currentpos = 0;
- while (currentpos < contents[which].bytes)
- { label("Loop start:");
- uvalue = getulong(&(contents[which].DataPtr[currentpos]));
- unumcat(uvalue, FALSE);
- if (uvalue % 4)
- { strcat(tempstring1, "!");
- }
- addreactionnode(&List2, tempstring1);
- currentpos += 4;
-
- label("Loop end:");
- uvalue = getulong(&(contents[which].DataPtr[currentpos]));
- unumcat(uvalue, FALSE);
- if (uvalue % 4)
- { strcat(tempstring1, "!");
- }
- addreactionnode(&List2, tempstring1);
- currentpos += 4;
- } } }
- elif (!strcmp(contents[which].name, "CHAN"))
- { chunkdesc("Specified channel, or combination of channels", TRUE);
-
- if (!iff.raw)
- { label("Channel:");
- svalue = getslong(contents[which].DataPtr);
- if (svalue == 2)
- { strcat(tempstring1, "Left");
- } elif (svalue == 4)
- { strcat(tempstring1, "Right");
- } elif (svalue == 6)
- { strcat(tempstring1, "Stereo (both)");
- } else strcat(tempstring1, "?");
- addreactionnode(&List2, tempstring1);
- } }
- elif (!strcmp(contents[which].name, "PAN "))
- { chunkdesc("Stereo sound using a single array of data", TRUE);
-
- if (!iff.raw)
- { label("Sound position:");
- svalue = getslong(contents[which].DataPtr);
- snumcat(svalue, FALSE);
- strcat(tempstring1, "/65536 ");
- if (svalue < 32768)
- { strcat(tempstring1, "(left)");
- } elif (svalue > 32678)
- { strcat(tempstring1, "(right)");
- } else
- { // assert(svalue == 32678);
- strcat(tempstring1, "(centre)");
- }
- addreactionnode(&List2, tempstring1);
- } }
- elif (!strcmp(contents[which].name, "VHDR"))
- { chunkdesc("Playback parameters for the sampled waveforms", TRUE);
-
- if (!iff.raw)
- { label("1-shot samples:");
- uvalue = getulong(contents[which].DataPtr);
- unumcat(uvalue, TRUE);
-
- label("Repeat samples:");
- uvalue = getulong(&(contents[which].DataPtr[4]));
- unumcat(uvalue, TRUE);
-
- label("Samples per cycle:");
- uvalue = getulong(&(contents[which].DataPtr[8]));
- unumcat(uvalue, TRUE);
-
- label("Sampling rate:");
- uvalue = getuword(&(contents[which].DataPtr[12]));
- unumcat(uvalue, TRUE);
-
- label("Octaves:");
- snumcat((SLONG) contents[which].DataPtr[14], TRUE); // UBYTE
-
- label("Compression:"); // UBYTE
- interpret(48, (ULONG) contents[which].DataPtr[15]);
-
- label("Volume:");
- svalue = getslong(&(contents[which].DataPtr[16]));
- svalue /= 1024; // LONG (Fixed)
- snumcat(svalue, FALSE);
- strcat(tempstring1, "/64");
- addreactionnode(&List2, tempstring1);
- } } }
- elif (!strcmp(queryform, "ILBM") || !strcmp(queryform, "ABCM") || !strcmp(queryform, "ANIM"))
- { if (!strcmp(contents[which].name, "CAMG"))
- { chunkdesc("Amiga display mode of a picture", TRUE);
-
- if (!iff.raw)
- { label("ModeID:");
- strcat(tempstring1, "$");
- hexalize(contents[which].DataPtr[0]);
- hexalize(contents[which].DataPtr[1]);
- hexalize(contents[which].DataPtr[2]);
- hexalize(contents[which].DataPtr[3]);
- addreactionnode(&List2, tempstring1);
- } }
- elif (!strcmp(queryform, "ANIM") && !strcmp(contents[which].name, "ANHD"))
- { chunkdesc("Animation header", TRUE);
-
- if (!iff.raw)
- { label("Compression method:");
- if (contents[which].DataPtr[0] == 74) // not a typo
- { strcat(tempstring1, "74 (Eric Graham)");
- } else
- { interpret(49, (ULONG) contents[which].DataPtr[0]);
- }
-
- label("Mask:");
- strcat(tempstring1, "%");
- binarize(contents[which].DataPtr[1]);
- addreactionnode(&List2, tempstring1);
-
- label("Entire width:");
- uvalue = getuword(&contents[which].DataPtr[2]); // UWORD
- unumcat(uvalue, FALSE);
- strcat(tempstring1, " pixels");
- addreactionnode(&List2, tempstring1);
-
- label("Entire height:");
- uvalue = getuword(&contents[which].DataPtr[4]); // UWORD
- unumcat(uvalue, FALSE);
- strcat(tempstring1, " pixels");
- addreactionnode(&List2, tempstring1);
-
- label("Width:");
- svalue = getsword(&contents[which].DataPtr[6]); // WORD
- snumcat(svalue, FALSE);
- strcat(tempstring1, " pixels");
- addreactionnode(&List2, tempstring1);
-
- label("Height:");
- svalue = getsword(&contents[which].DataPtr[8]); // WORD
- snumcat(svalue, FALSE);
- strcat(tempstring1, " pixels");
- addreactionnode(&List2, tempstring1);
-
- label("Absolute time:");
- uvalue = getulong(&contents[which].DataPtr[10]); // ULONG
- unumcat(uvalue, FALSE);
- strcat(tempstring1, "/60 of a second");
- addreactionnode(&List2, tempstring1);
-
- label("Relative time:");
- uvalue = getulong(&contents[which].DataPtr[14]); // ULONG
- unumcat(uvalue, FALSE);
- strcat(tempstring1, "/60 of a second");
- addreactionnode(&List2, tempstring1);
-
- label("Interleave:");
- if (contents[which].DataPtr[18] == 0)
- { strcat(tempstring1, "0 (2 frames back)");
- } else
- { stcl_d(tempstring2, contents[which].DataPtr[18]);
- strcat(tempstring1, tempstring2);
- strcat(tempstring1, " frames back");
- }
- addreactionnode(&List2, tempstring1);
-
- // now a pad byte (19)
-
- label("Flags:");
- uvalue = getulong(&contents[which].DataPtr[20]); // ULONG
-
- label(" Data length:");
- if (uvalue & 1)
- { strcat(tempstring1, "Long");
- } else
- { strcat(tempstring1, "Short");
- }
- addreactionnode(&List2, tempstring1);
-
- label(" Set/XOR:");
- if (uvalue & 2)
- { strcat(tempstring1, "Set");
- } else
- { strcat(tempstring1, "XOR");
- }
- addreactionnode(&List2, tempstring1);
-
- label(" Info:");
- if (uvalue & 4)
- { strcat(tempstring1, "One info list for all planes");
- } else
- { strcat(tempstring1, "Separate info for each plane");
- }
- addreactionnode(&List2, tempstring1);
-
- label(" Run length encoded?");
- dobool((UBYTE) (uvalue & 8));
-
- label(" Encoding:");
- if (uvalue & 16)
- { strcat(tempstring1, "Vertical");
- } else
- { strcat(tempstring1, "Horizontal");
- }
- addreactionnode(&List2, tempstring1);
-
- label(" Info offsets:");
- if (uvalue & 32)
- { strcat(tempstring1, "Short");
- } else
- { strcat(tempstring1, "Long");
- }
- addreactionnode(&List2, tempstring1);
-
- // now 16 reserved bytes
- } }
- elif (!strcmp(queryform, "ANIM") && !strcmp(contents[which].name, "DLTA"))
- { chunkdesc("Delta compression data", FALSE);
- } elif (!strcmp(contents[which].name, "DPI "))
- { chunkdesc("Dots per inch", TRUE);
-
- if (!iff.raw)
- { label("Dots per inch:");
- // There are 20 characters in the first column.
- uvalue = getuword(contents[which].DataPtr);
- unumcat(uvalue, FALSE);
- strcat(tempstring1, "x");
- uvalue = getuword(&(contents[which].DataPtr[2]));
- unumcat(uvalue, TRUE);
- } }
- elif (!strcmp(contents[which].name, "CMAP"))
- { chunkdesc("Colour map data", FALSE);
- } elif (!strcmp(contents[which].name, "BODY"))
- { chunkdesc("Image data chunk", FALSE);
- } elif (!strcmp(contents[which].name, "EPSF"))
- { chunkdesc("Encapsulated PostScript representation of image", TRUE);
-
- if (!iff.raw)
- {
- label("Left X:");
- svalue = getsword(contents[which].DataPtr);
- snumcat(svalue, TRUE);
-
- label("Top Y:");
- svalue = getsword(&(contents[which].DataPtr[2]));
- snumcat(svalue, TRUE);
-
- label("Right X:");
- svalue = getsword(&(contents[which].DataPtr[4]));
- snumcat(svalue, TRUE);
-
- label("Bottom Y:");
- svalue = getsword(&(contents[which].DataPtr[6]));
- snumcat(svalue, TRUE);
- } }
- elif (!strcmp(contents[which].name, "DEST"))
- { chunkdesc("Scatter bitplanes into a deeper destination image", TRUE);
-
- if (!iff.raw)
- {
- label("Source bitplanes:");
- snumcat((SLONG) contents[which].DataPtr[0], TRUE);
-
- // next (1) is a pad byte.
-
- label("PlanePick:");
- strcat(tempstring1, "%"); // UWORD
- binarize(contents[which].DataPtr[2]);
- binarize(contents[which].DataPtr[3]);
- addreactionnode(&List2, tempstring1);
-
- label("PlaneOnOff:");
- strcat(tempstring1, "%"); // UWORD
- binarize(contents[which].DataPtr[4]);
- binarize(contents[which].DataPtr[5]);
- addreactionnode(&List2, tempstring1);
-
- label("PlaneMask:");
- strcat(tempstring1, "%"); // UWORD
- binarize(contents[which].DataPtr[6]);
- binarize(contents[which].DataPtr[7]);
- addreactionnode(&List2, tempstring1);
- } }
- elif (!strcmp(contents[which].name, "GRAB"))
- { chunkdesc("Locates a hotspot, when used as a pointer or brush", TRUE);
-
- if (!iff.raw)
- { label("Hotspot:");
- svalue = getsword(contents[which].DataPtr);
- snumcat(svalue, FALSE);
- strcat(tempstring1, ",");
- svalue = getsword(&(contents[which].DataPtr[2]));
- snumcat(svalue, TRUE);
- } }
- elif (!strcmp(contents[which].name, "SPRT"))
- { chunkdesc("This image is intended as a sprite", TRUE);
-
- if (!iff.raw)
- { label("Precedence:");
- uvalue = getuword(contents[which].DataPtr);
- unumcat(uvalue, TRUE);
- } }
- elif (!strcmp(contents[which].name, "BMHD"))
- { /* UWORD w, h; 0-1, 2-3
- WORD x, y; 4-5, 6-7
- UBYTE nPlanes; 8
- UBYTE Masking; 9
- UBYTE Compression; 10
- UBYTE pad; 11
- UWORD transparentColour; 12-13
- UBYTE xAspect, yAspect; 14, 15
- WORD pageWidth, pageHeight; 16-17, 18-19 */
-
- chunkdesc("Data necessary to understand the BODY chunk", TRUE);
-
- if (!iff.raw)
- {
- label("Image size:");
- uvalue = getuword(contents[which].DataPtr); // UWORD
- unumcat(uvalue, FALSE);
- strcat(tempstring1, "x");
- uvalue = getuword(&(contents[which].DataPtr[2])); // UWORD
- unumcat(uvalue, TRUE);
-
- label("Position:");
- svalue = getsword(&(contents[which].DataPtr[4])); // WORD
- snumcat(svalue, FALSE);
- strcat(tempstring1, ",");
- svalue = getsword(&(contents[which].DataPtr[6])); // WORD
- snumcat(svalue, TRUE);
-
- label("Bitplanes:");
- snumcat((SLONG) contents[which].DataPtr[8], TRUE);
- // tell number of colours to user?
-
- label("Masking:");
- interpret(45, (ULONG) contents[which].DataPtr[9]);
-
- label("Compression:");
- interpret(46, (ULONG) contents[which].DataPtr[10]);
-
- // Next (11) is a pad byte.
-
- label("Transparent colour:");
- if (contents[which].DataPtr[9] != 2
- && contents[which].DataPtr[9] != 3)
- { strcat(tempstring1, "n/a");
- addreactionnode(&List2, tempstring1);
- } else
- { uvalue = getuword(&(contents[which].DataPtr[12]));
- unumcat(uvalue, TRUE);
- }
-
- label("Aspect ratio:");
- snumcat((SLONG) contents[which].DataPtr[14], FALSE);
- strcat(tempstring1, ":");
- snumcat((SLONG) contents[which].DataPtr[15], TRUE);
-
- label("Page size:");
- svalue = getsword(&(contents[which].DataPtr[16])); // WORD
- snumcat(svalue, FALSE);
- strcat(tempstring1, "x");
- svalue = getsword(&(contents[which].DataPtr[18])); // WORD
- snumcat(svalue, TRUE);
- } } }
- elif (!strcmp(queryform, "RSND"))
- { if (!strcmp(contents[which].name, "RSHD"))
- { chunkdesc("Sound header", TRUE);
-
- if (!iff.raw)
- { label("Length:");
- uvalue = getulong(contents[which].DataPtr); // ULONG
- unumcat(uvalue, TRUE);
-
- label("Frequency:");
- uvalue = getulong(&contents[which].DataPtr[4]); // ULONG
- unumcat(uvalue, TRUE);
-
- label("Bits per sample:");
- uvalue = getulong(&contents[which].DataPtr[8]); // ULONG
- unumcat(uvalue, TRUE);
-
- label("Number of channels:");
- uvalue = getulong(&contents[which].DataPtr[12]); // ULONG
- unumcat(uvalue, TRUE);
- } }
- elif (!strcmp(contents[which].name, "RBOD"))
- { chunkdesc("Sound body", FALSE);
- } }
-
- if (!known || iff.raw)
- { for (i = 0; i < contents[which].bytes; i += BYTESPERLINE)
- { strcpy(tempstring1, "$");
-
- hexalize(i / 16777216); // do 1st byte
- j = i % 16777216; // remove 1st byte
- hexalize(j / 65536); // do 2nd byte
- j %= 65536; // remove 2nd byte
- hexalize(j / 256); // do 3rd byte
- hexalize(j % 256); // do 4th byte
-
- strcat(tempstring1, ": ");
- for (j = 0; j < BYTESPERLINE; j++)
- { if (contents[which].bytes > i + j)
- { hexalize(contents[which].DataPtr[i + j]);
- } else
- { strcat(tempstring1, "##");
- }
- if (j % 2)
- { strcat(tempstring1, " ");
- } }
- for (j = 0; j < BYTESPERLINE; j++)
- { if (contents[which].bytes > i + j)
- { if (contents[which].DataPtr[i + j] < ' ') // if an unprintable character
- { strcat(tempstring1, ".");
- } else
- { length = strlen(tempstring1);
- tempstring1[length] = contents[which].DataPtr[i + j];
- tempstring1[length + 1] = 0;
- } }
- else
- { strcat(tempstring1, "#");
- } }
- addreactionnode(&List2, tempstring1);
- } }
- if (!known)
- { chunkdesc("?", FALSE);
- }
-
- SetGadgetAttrs
- ( iff_gadgets[GID_6_LB2],
- MainWindowPtr, NULL,
- LISTBROWSER_Labels, &List2,
- TAG_END
- );
- }
-
- MODULE void chunkdesc(STRPTR desc, ABOOL isknown)
- { SetGadgetAttrs
- ( iff_gadgets[GID_6_ST4],
- MainWindowPtr, NULL,
- STRINGA_TextVal, desc,
- TAG_END
- );
- known = isknown;
- }
-
- MODULE void binarize(UBYTE data)
- { SLONG i; // must be signed
-
- for (i = 7; i >= 0; i--)
- { if (data & (1 << i))
- { strcat(tempstring1, "1");
- } else
- { strcat(tempstring1, "0");
- } } }
-
- MODULE void hexalize(UBYTE data)
- { // Converts an unsigned byte into a hexadecimal string
-
- // do the high byte
- if (data / 16 >= 10)
- { tempstring2[0] = (data / 16) - 10 + 'A'; // must be done in this order to prevent overflow during calculation of the value
- } else
- { tempstring2[0] = (data / 16) + '0';
- }
-
- // now the low byte
- if (data % 16 >= 10)
- { tempstring2[1] = (data % 16) - 10 + 'A';
- } else
- { tempstring2[1] = (data % 16) + '0';
- }
- tempstring2[2] = 0;
- strcat(tempstring1, tempstring2);
- }
-
- MODULE ULONG getulong(UBYTE* start)
- { return (ULONG) ((16777216 * *(start ))
- + ( 65536 * *(start + 1))
- + ( 256 * *(start + 2))
- + *(start + 3));
- }
- MODULE SLONG getslong(UBYTE* start)
- { return (SLONG) ((16777216 * *(start ))
- + ( 65536 * *(start + 1))
- + ( 256 * *(start + 2))
- + *(start + 3));
- }
- MODULE ULONG getuword(UBYTE* start)
- { return (ULONG) (( 256 * *(start ))
- + *(start + 1));
- }
- MODULE SLONG getsword(UBYTE* start)
- { return (SLONG) (( 256 * *(start ))
- + *(start + 1));
- }
- MODULE SLONG getsbyte(UBYTE* start)
- { return (SBYTE) (*start);
- }
-
- MODULE void writeiffgadgets(void)
- { // update the gadgets according to variables
-
- SetGadgetAttrs
- ( iff_gadgets[GID_6_CB2], MainWindowPtr, NULL,
- GA_Selected, iff.obsolete,
- TAG_END);
- RefreshGadgets((struct Gadget *) iff_gadgets[GID_6_CB2], MainWindowPtr, NULL);
- SetGadgetAttrs
- ( iff_gadgets[GID_6_CB3], MainWindowPtr, NULL,
- GA_Selected, iff.private,
- TAG_END);
- RefreshGadgets((struct Gadget *) iff_gadgets[GID_6_CB3], MainWindowPtr, NULL);
- SetGadgetAttrs
- ( iff_gadgets[GID_6_CB4], MainWindowPtr, NULL,
- GA_Selected, iff.proposal,
- TAG_END);
- RefreshGadgets((struct Gadget *) iff_gadgets[GID_6_CB4], MainWindowPtr, NULL);
- SetGadgetAttrs
- ( iff_gadgets[GID_6_CB5], MainWindowPtr, NULL,
- GA_Selected, iff.reserved,
- TAG_END);
- RefreshGadgets((struct Gadget *) iff_gadgets[GID_6_CB5], MainWindowPtr, NULL);
- SetGadgetAttrs
- ( iff_gadgets[GID_6_CB6], MainWindowPtr, NULL,
- GA_Selected, iff.standard,
- TAG_END);
- RefreshGadgets((struct Gadget *) iff_gadgets[GID_6_CB6], MainWindowPtr, NULL);
- SetGadgetAttrs
- ( iff_gadgets[GID_6_CB7], MainWindowPtr, NULL,
- GA_Selected, iff.unregistered,
- TAG_END);
- RefreshGadgets((struct Gadget *) iff_gadgets[GID_6_CB7], MainWindowPtr, NULL);
- SetGadgetAttrs
- ( iff_gadgets[GID_6_CB8], MainWindowPtr, NULL,
- GA_Selected, iff.rkm,
- TAG_END);
- RefreshGadgets((struct Gadget *) iff_gadgets[GID_6_CB8], MainWindowPtr, NULL);
- SetGadgetAttrs
- ( iff_gadgets[GID_6_CB9], MainWindowPtr, NULL,
- GA_Selected, iff.cd,
- TAG_END);
- RefreshGadgets((struct Gadget *) iff_gadgets[GID_6_CB9], MainWindowPtr, NULL);
- SetGadgetAttrs
- ( iff_gadgets[GID_6_ST1],
- MainWindowPtr, NULL,
- STRINGA_TextVal, queryform,
- TAG_END
- );
- chunkdesc("-", FALSE);
- }
-
- MODULE void dotextattr(UBYTE* offset)
- { ULONG uvalue;
-
- // handles TextAttr structure (8 bytes)
- // name pointer is ignored
-
- label(" Height:");
- uvalue = getuword(offset + 4);
- unumcat(uvalue, TRUE);
-
- addreactionnode(&List2, " Style:");
-
- label(" Underlined?");
- dobool((*(offset + 6)) & 1); // FSF_UNDERLINED
-
- label(" Bold?");
- dobool((*(offset + 6)) & 2); // FSF_BOLD
-
- label(" Italic?");
- dobool((*(offset + 6)) & 4); // FSF_ITALIC
-
- label(" Extended?");
- dobool((*(offset + 6)) & 8); // FSF_EXTENDED
-
- label(" Colour font?");
- dobool((*(offset + 6)) & 64); // FSF_COLORFONT
-
- label(" Tagged?");
- dobool((*(offset + 6)) & 128); // FSF_TAGGED
-
- addreactionnode(&List2, " Flags:");
-
- label(" ROM font?");
- dobool((*(offset + 7)) & 1); // FPF_ROMFONT
-
- label(" Disk font?");
- dobool((*(offset + 7)) & 2); // FPF_DISKFONT
-
- label(" Reversed?");
- dobool((*(offset + 7)) & 4); // FPF_REVPATH
-
- label(" HiRes non-interlaced?");
- dobool((*(offset + 7)) & 8); // FPF_TALLDOT
-
- label(" LoRes interlaced?");
- dobool((*(offset + 7)) & 16); // FPF_WIDEDOT
-
- label(" Proportional?");
- dobool((*(offset + 7)) & 32); // FPF_PROPORTIONAL
-
- label(" Designed?");
- dobool((*(offset + 7)) & 64); // FPF_DESIGNED
-
- label(" Removed?");
- // this one has a ! after its `Yes', since it should never be TRUE.
- if (*(offset + 7) & 128) // FPF_REMOVED
- { strcat(tempstring1, "Yes!");
- } else
- { strcat(tempstring1, "No");
- }
- addreactionnode(&List2, tempstring1);
- }
-
- MODULE void docountry(UBYTE* offset)
- { ULONG uvalue;
-
- // handles CountryPrefs structure (8 bytes)
-
- // 16 reserved bytes at start
-
- label("Country code:");
- uvalue = getulong(offset + 16); // ULONG
- unumcat(uvalue, TRUE);
-
- label("Telephone code:");
- uvalue = getulong(offset + 20); // ULONG
- unumcat(uvalue, TRUE);
-
- label("Measuring system:");
- interpret(50, (ULONG) *(offset + 24));
-
- label("Long date/time format:");
- strcat(tempstring1, offset + 25); // 80 chars
- addreactionnode(&List2, tempstring1);
-
- label("Long date format:");
- strcat(tempstring1, offset + 105); // 40 chars
- addreactionnode(&List2, tempstring1);
-
- label("Long time format:");
- strcat(tempstring1, offset + 145); // 40 chars
- addreactionnode(&List2, tempstring1);
-
- label("Short date/time format:");
- strcat(tempstring1, offset + 185); // 80 chars
- addreactionnode(&List2, tempstring1);
-
- label("Short date format:");
- strcat(tempstring1, offset + 265); // 40 chars
- addreactionnode(&List2, tempstring1);
-
- label("Short time format:");
- strcat(tempstring1, offset + 305); // 40 chars
- addreactionnode(&List2, tempstring1);
-
- addreactionnode(&List2, "Numeric values:");
-
- label(" Decimal point:");
- strcat(tempstring1, offset + 345); // 10 chars
- addreactionnode(&List2, tempstring1);
-
- label(" Intgr group separator:");
- strcat(tempstring1, offset + 355); // 10 chars
- addreactionnode(&List2, tempstring1);
-
- label(" Frac. group separator:");
- strcat(tempstring1, offset + 365); // 10 chars
- addreactionnode(&List2, tempstring1);
-
- /* Integer group size (10 chars) and
- Fractional group size (10 chars): not strings (currently skipped */
-
- addreactionnode(&List2, "General monetary values:");
-
- label(" Decimal point:");
- strcat(tempstring1, offset + 395); // 10 chars
- addreactionnode(&List2, tempstring1);
-
- label(" Intgr group separator:");
- strcat(tempstring1, offset + 405); // 10 chars
- addreactionnode(&List2, tempstring1);
-
- label(" Frac. group separator:");
- strcat(tempstring1, offset + 415); // 10 chars
- addreactionnode(&List2, tempstring1);
-
- /* Integer group size (10 chars) and
- Fractional group size (10 chars): not strings (currently skipped) */
-
- addreactionnode(&List2, " Digits after decimal point:");
-
- label(" Intranational:");
- snumcat((SLONG) ((UBYTE) *(offset + 445)), TRUE);
-
- label(" International:");
- snumcat((SLONG) ((UBYTE) *(offset + 446)), TRUE);
-
- addreactionnode(&List2, "Currency symbols:");
-
- label(" Large amounts symbol:");
- strcat(tempstring1, offset + 447); // 10 chars
- addreactionnode(&List2, tempstring1);
-
- label(" Small amounts symbol:");
- strcat(tempstring1, offset + 457); // 10 chars
- addreactionnode(&List2, tempstring1);
-
- label(" ISO 4217 code:");
- strcat(tempstring1, offset + 467); // 10 chars
- addreactionnode(&List2, tempstring1);
-
- addreactionnode(&List2, "Positive monetary values:");
-
- label(" Positive sign:");
- strcat(tempstring1, offset + 477); // 10 chars
- addreactionnode(&List2, tempstring1);
-
- label(" Space next to sign?");
- interpret(51, (ULONG) *(offset + 487));
-
- label(" Positive sign pos.:");
- interpret(52, (ULONG) *(offset + 488));
-
- label(" Currency symbol pos.:");
- interpret(53, (ULONG) *(offset + 489));
-
- addreactionnode(&List2, "Negative monetary values:");
-
- label(" Negative sign:");
- strcat(tempstring1, offset + 500); // 10 chars
- addreactionnode(&List2, tempstring1);
-
- label(" Space next to sign?");
- interpret(51, (ULONG) *(offset + 500));
-
- label(" Negative sign pos.:");
- interpret(52, (ULONG) *(offset + 501));
-
- label(" Currency symbol pos.:");
- interpret(53, (ULONG) *(offset + 502));
-
- label("First day of the week:");
- interpret(54, (ULONG) *(offset + 503));
- }
-
- AGLOBAL void iff_init(void)
- { iff.raw = FALSE;
-
- NewList(&List1);
- NewList(&List2);
- }
-
- AGLOBAL void iff_die(void)
- { IOBuffer[19] = (UBYTE) iff.raw;
- }
-
- AGLOBAL void iff_config(void)
- { iff.raw = (ULONG) IOBuffer[19];
- }
-
- AGLOBAL ULONG Hook6Func(struct Hook *h, VOID *o, VOID *msg)
- { /* "When the hook is called, the data argument points to the
- window object and message argument to the IntuiMessage." */
-
- UWORD code, qual;
- ULONG scroll = 0;
-
- geta4(); // wait till here before doing anything
-
- code = ((struct IntuiMessage *) msg)->Code;
- qual = ((struct IntuiMessage *) msg)->Qualifier;
-
- switch(code)
- {
- case SCAN_HELP:
- helpabout();
- break;
- case SCAN_ESCAPE:
- if ((qual & IEQUALIFIER_LSHIFT) || (qual & IEQUALIFIER_RSHIFT))
- { cleanexit(EXIT_SUCCESS);
- } else page = 0;
- break;
- case SCAN_UP:
- if (qual & IEQUALIFIER_CONTROL)
- { scroll = LBP_TOP;
- } elif (qual & IEQUALIFIER_LSHIFT || qual & IEQUALIFIER_RSHIFT)
- { scroll = LBP_PAGEUP;
- } else scroll = LBP_LINEUP;
- break;
- case SCAN_DOWN:
- if (qual & IEQUALIFIER_CONTROL)
- { scroll = LBP_BOTTOM;
- } elif (qual & IEQUALIFIER_LSHIFT || qual & IEQUALIFIER_RSHIFT)
- { scroll = LBP_PAGEDOWN;
- } else scroll = LBP_LINEDOWN;
- break;
- case SCAN_PERIOD:
- if (asl("~(#?.info)"))
- { strcpy(iff.pathname, aslresult);
-
- SetGadgetAttrs
- ( iff_gadgets[GID_6_ST6], MainWindowPtr, NULL,
- STRINGA_TextVal, iff.pathname,
- TAG_END
- ); // we don't know how many files in advance...
-
- readiff();
- }
- break;
- case SCAN_F:
- ActivateLayoutGadget(iff_gadgets[GID_6_LY1], MainWindowPtr, NULL, (Object) iff_gadgets[GID_6_ST1]);
- break;
- case SCAN_P:
- ActivateLayoutGadget(iff_gadgets[GID_6_LY1], MainWindowPtr, NULL, (Object) iff_gadgets[GID_6_ST6]);
- break;
- case SCAN_R:
- // the gadget is handled automatically by the system, all we need
- // to do is update our internal record of the state of the gadget
- if (!(GetAttr
- ( GA_Selected, iff_gadgets[GID_6_CB1], (ULONG *) &iff.raw
- )))
- { rq("Unsupported inquiry!"); // should never happen
- }
- if (selectedchunk && known)
- { tellchunk(selectedchunk);
- }
- break;
- default:
- break;
- }
-
- if (code == SCAN_UP || code == SCAN_DOWN)
- { SetGadgetAttrs
- ( iff_gadgets[GID_6_LB2], // pointer to gadget
- MainWindowPtr, // pointer to window (not window object!)
- NULL, // pointer to requester
- LISTBROWSER_Position, scroll, // tags
- TAG_DONE // done
- );
- }
-
- return(1);
- }
-
- MODULE void label(STRPTR text)
- { ULONG i, length;
-
- length = strlen(text);
-
- strcpy(tempstring1, text);
- if (length < LABELLENGTH)
- { for (i = length; i <= LABELLENGTH; i++)
- { strcat(tempstring1, " ");
- } } }
-
- MODULE void dobool(UBYTE thebool)
- { if (thebool)
- { strcat(tempstring1, "Yes");
- } else strcat(tempstring1, "No");
- addreactionnode(&List2, tempstring1);
- }
-
- MODULE void snumcat(SLONG thenumber, ABOOL finished)
- { stcl_d(tempstring2, thenumber);
- strcat(tempstring1, tempstring2);
-
- if (finished)
- { addreactionnode(&List2, tempstring1);
- } }
-
- MODULE void unumcat(ULONG thenumber, ABOOL finished)
- { stcul_d(tempstring2, thenumber);
- strcat(tempstring1, tempstring2);
-
- if (finished)
- { addreactionnode(&List2, tempstring1);
- } }
-
- MODULE void interpret(ULONG tablenum, ULONG value)
- { snumcat((SLONG) value, FALSE);
- strcat(tempstring1, " (");
-
- if (value > table[tablenum].entries)
- { strcat(tempstring1, "?");
- } else
- { strcat(tempstring1, table[tablenum].tablestring[value]);
- }
-
- strcat(tempstring1, ")");
- addreactionnode(&List2, tempstring1);
- }
-